Babies don't know who their dad is in the womb directly as in being able to directly recognize their dad while they are in the womb.
However babies can become familiar with their dad's voice and other sensory cues when in the womb and once they are born they are often able to recognize their dad once they are outside of the womb through their dad's voice.
Babies have the ability to hear their father's voice through the mother's body as early as the second trimester of pregnancy.
Babies often also develop a preference for their dad's voice, which can also be reinforced after they are born.
And babies also often sense their father's or dad's touch through the mother's body.
And the baby may also be exposed to their dad's scent, which can also become familiar to the baby over time.
And the early sensory experiences can also contribute to the development of a bond between the baby and their dead.
And studies have also shown that babies that are exposed to their dad's voice and touch in the womb, tend to also have stronger attachments to their father later in life.
Babies in the womb cannot consciously know their fathers, but they can become very familiar with their father's voice, their touch and other sensory cures, which also lays a foundation for a strong, father and child bond as the baby grows.