All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The basic principle in this case is that the child is traced back to the husband as he is the owner of the bed, as confirmed in the authentic Sunnah of the Prophet . So the claim of your wife that those children are illegitimate has no consideration as long as you did not hasten to deny them with Li’aan (i.e. a husband and his wife invoke the curse of Allaah on the liar among them when he accuses her of having committed adultery). For more benefit, please refer to Fataawa 193277 and 176757.
Moreover, DNA testing is not relied upon by itself in confirming or denying the lineage, as clarified in Fataawa 82709 and 90098.
Therefore, those children are your legitimate children and all the rulings related to sonship are confirmed between you and them, like spending on them, inheritance and the like. Their custody is the right of their mother unless she gets remarried or that there is an impediment which prevents her from taking their custody like being dissolute, in which case, the custody of the children moves to the female who is more deserving according to the order stated by the jurists and which is mentioned in Fatwa 84618.
Allaah Knows best.