The Messenger of Allah ﷺ was asked about the child born of fornication. He said, "There is no good in him. A pair of sandals with which I fight in the cause of Allah is more beloved to me than freeing a child born of fornication."
حدثنا حسين وأبو نعيم قالا ثنا إسرائيل عن زيد بن جبير عن أبي يزيد الضني
سئل رسول الله ﷺ عن ولد الزنا قال لا خير فيه نعلان أجاهد بهما في سبيل الله أحب إلي من أن أعتق ولد زنا
Its isnad is daif, due to the unknown status of Abu Yazid Dabbi, as they said, and more sahih than it is what was narrated that he said, "He is the worst of the three, if he acts according to the deeds of his two parents." See it at 24665, and see Sunan Abu Dawud 4/29 no. 3963, Ibn Majah 2/846 no. 2531, Hakim 4/241, and Bayhaqi 10/58.