Yes, you can do DNA testing for an alleged father both before the baby is born and after. I will say however that doing the DNA testing before the baby is born is dangerous because the needle used to collect the amniotic fluid penetrates the amniotic sack.