I heard the Prophet ﷺ saying, "Whoever claims to be the son of a person other than his father, and he knows that person is not his father, then Paradise will be forbidden for him." I mentioned that to Abu Bakra, and he said, "My ears heard that and my heart memorized it from Messenger of Allah ﷺ. (Using translation from Bukhārī 6766)
أَنَّ رَسُولَ اللهِ ﷺ قَالَ مَنِ ادُّعِيَ إِلَى غَيْرِ أَبِيهِ وَهُوَ يَعْلَمُ أَنَّهُ غَيْرُ أَبِيهِ فَالْجَنَّةُ عَلَيْهِ حَرَامٌ قَالَ فَذَكَرْتُ ذَلِكَ لِأَبِي بَكْرَةَ فَقَالَ سَمِعَتْهُ أُذُنَايَ وَوَعَاهُ قَلْبِي