Answered according to Hanafi Fiqh by Darulifta-Deoband.com
If a person after giving talaq comes to know that the lady was pregnant and firstly she told you that you are the child of this father but later refused and again after some time told that this belongs to you but actually she was having affair with some other man behind her husband. In that case what will the man do?

بسم الله الرحمن الرحيم

(Fatwa: 715/715/M=1434)

The woman was pregnant and it was learnt after divorce then her iddah shall be over after birth. After that the gap between the nikah and child birth shall be observed. If the child was born after six month from the nikah or more than it then the child shall be considered legitimate and the husband should consider him his child, but if the child was born before six months then it shall be considered illegitimate.

Allah knows Best!

Darul Ifta,
Darul Uloom Deoband