meaning that Allaah Alone has knowledge of that so long as it has not yet been fully formed.
But once the foetus is fully formed, then others may have knowledge of it. Ibn Katheer
(may Allaah have mercy on him) said in his tafseer of the aayah from Soorat Luqmaan:
“No one knows what Allaah wants to create in the wombs apart from Him, but once He decrees that
it should be male or female, doomed or blessed, the angels who are appointed in charge of it know that,
and whoever else He wills among His creation.”
When does an embryo become male or female?
Between week 7 and week 12 of pregnancy, the foundations of your baby’s sex organs develop.
Long Link
check this also
If you have a prenatal blood test (NIPT), you may be able to find out your baby's sex as early as
11 weeks of pregnancy. Ultrasounds may reveal sex organs by 14 weeks,
but they aren't considered fully accurate until 18 weeks. If you have CVS at 10 weeks, the results
will reveal your baby's sex by 12 weeks. If you have an amnio at 16 weeks, you can find out by 18 weeks.
With IVF, you can find out the sex before you even transfer the embryos.
Long Link
Since an ultrasound creates an image of your baby, it can also reveal the sex of your baby.
Most doctors schedule an ultrasound at around 18 to 21 weeks, but the sex may be determined by ultrasound as
early as 14 weeksTrusted Source.
It’s not always 100 percent accurate, though. Your baby might be in an awkward position, which
makes it difficult to clearly see the genitals. If the technician can’t find a penis, they’ll conclude that
you’re having a girl and vice versa. But mistakes do happen.
https://www.healthline.com/
Finding out the sex of a developing baby can be an exciting moment in pregnancy. Early blood tests now make this
possible toward the end of the first trimester. However, the results are not always 100% accurate.
the website covers all methods nothing is 100% accurate
https://www.medicalnewstoday.com/articles/when-can-you-find-out-the-sex-of-a-baby#methods
AGD is helpful as an ultrasonographic marker that can determine fetal gender in the first trimester,
especially after 12 wks.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6652156/