Abu Hurairah reported,

While we were with the Messenger of Allah ﷺ, a man stood up and said, "Messenger of Allah, a black boy has been born to me."The Messenger of Allah ﷺ then said... and he mentioned the hadith like it. It also included, "It was for this reason that the Messenger of Allah ﷺ ruled that no man may disown a child born on his bed unless he claims to have witnessed an act of indecency."

Azami 6633

Sahih

عن أبي هريرة قال

بينما نحن عند رسول الله ﷺ قام رجل فقال: يا رسول الله! إني ولد لي غلام أسود. فقال رسول الله ﷺ فذكر الحديث مثله. وجاء فيه: فمن أجله قضى رسول الله ﷺ هذا: لا يجوز لرجل أن ينتفي من ولد ولد على فراشه إلا أن يزعم: أنه رأى فاحشة.

الأعظمي 6633صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Lian
Section
Mutual cursing does not occur when a man doubts his child
Numbering
Jami al-Kamil 6633 (2nd edition)
Azami 6633