From a basic understanding with X and Y chromosomes (in humans):
A karyotype of a fetus in utero can be done to examine the chromosomes. This can show whether the fetus is XX (female) or XY (male). A karyotype can also help determine the presence of other chromosomal abnormalities such as Down’s Syndrome, Turner’s Syndrome, Kleifelter’s, etc.
However, this is not just a single determination for biological sex. There are individuals who can be XXX, XXY, and XYY. Hormones also play a significant role in determining biological sex, especially around puberty but levels can vary greatly and at different stages in life.
So the easy answer, karyotyping can help determine biological sex.
The real answer, it’s much more complicated.