The Prophet ﷺ said, "If somebody claims to be the son of any other than his real father knowingly, he but disbelieves in Allah, and if somebody claims to belong to some folk to whom he does not belong, let such a person take his place in the (Hell) Fire."
أَنَّهُ سَمِعَ النَّبِيَّ ﷺ يَقُولُ لَيْسَ مِنْ رَجُلٍ ادَّعَى لِغَيْرِ أَبِيهِ وَهْوَ يَعْلَمُهُ إِلاَّ كَفَرَ وَمَنِ ادَّعَى قَوْمًا لَيْسَ لَهُ فِيهِمْ فَلْيَتَبَوَّأْ مَقْعَدَهُ مِنَ النَّارِ