Yes newborns do know their dad and can sense who their dad is.
For example if you hand the newborn baby to a stranger they may cry but if you hand the newborn to their dad they may not cry.
In the beginning the newborn baby may even cry when their dad holds them or tries to hold them but it doesn't mean that the newborn hates you.
It just means that the newborn is not used to the dad yet and eventually they will get used to their dad and allow the dad to hold them.
Newborns more easily know their mother because they were in the mothers womb for the 9 months.
Also newborn babies can and do feel love when you hold them and care for them.
The newborn cannot tell you they feel the love but the newborn baby does feel the love and the newborn baby can also sense when they are not loved.
Just like a newborn can sense when they don't like someone by crying the newborn can also sense the love they feel from their mother, father, siblings etc.
So even though the newborn is unable to let you know they know you love them they still do.
Eventually as the baby gets older they can even more express their love for you and show their love back to you.