When talking about finding out if your baby is a boy or a girl, it's finding out the sex, not the gender

Ashley

"In general terms, "sex" refers to the biological differences between males and females, such as the genitalia and genetic differences. "Gender" is more difficult to define but can refer to the role of a male or female in society (gender role), or an individual's concept of themselves (gender identity)."

From: Sex And Gender: What Is The Difference? - Medical News Today