My mother told me baby's features form slowly, but scientifically gender is set right at conception. Focus on eating healthy and keeping yourself happy.
The baby's gender is decided the moment sperm meets egg, but we can't change or choose it. Right now in my 3rd trimester, my swollen feet are my only focus haha.
Biologically gender is fixed at conception itself, though genitals develop around 12 weeks. Please focus on a healthy pregnancy and follow your doctor's advice.