Abu Dharr reported,

He heard the Prophet ﷺ say, "Any man who claims someone other than his real father as his father, knowing the truth, has committed disbelief. And whoever claims to belong to a people to whom he has no lineage, let him take his seat in the Fire."

Azami 13033

Sahih

عن أبي ذر

أنه سمع النبي ﷺ يقول: ليس من رجل ادعى لغير أبيه وهو يعلمه إلا كفر، ومن ادعى قوما ليس له فيهم فليتبوأ مقعده من النار.

الأعظمي 13033صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Tafsir of Surah Ahzab
Section
His saying, "Call them by their fathers. It is more just in the sight of Allah. But if you do not know their fathers, then they are your brothers in religion and your allies. And there is no blame upon you for what you did by mistake, but only for what your hearts intended. And Allah is Forgiving, Merciful."
Numbering
Jami al-Kamil 13033 (2nd edition)
Azami 13033