At least, that's what his legal genealogy was in Matthew 1:
2 Abraham became the father of Isaac, ... 5 Salmon the father of Boaz, whose mother was Rahab.... 6 Jesse the father of David the king...16Jacob the father of Joseph, the husband of Mary. Of her was born Jesus who is called the Messiah.
Now, if you regard the Matthew genealogy as a legal and not a genetic genealogy, you'd have to look to the presumably genetic genealogy, the genealogy of, presumably, Mary, found in Luke. And that genealogy (Luke 3) does not name Rahab; in fact it does not name any female ancestor.
Unless the Mother has half of her genes in the gestating child, the child is related to the father by genes, not the mother, genetically. Once the amniotic sac closes (the water world), the new individual builds their own body. The Woman’s body builds none of the child gestating in her womb.