Sunan Ibn Majah, Hadith 2100

It was narrated from Abdullah bin Buraidah that his father told that : the Messenger of Allah said: "Whoever says: 'I have nothing to do with Islam,' if he is lying then he is as he said, and if he is telling the truth, his Islam will not be sound."

حَدَّثَنَا عَمْرُو بْنُ رَافِعٍ الْبَجَلِيُّ، حَدَّثَنَا الْفَضْلُ بْنُ مُوسَى، عَنِ الْحُسَيْنِ بْنِ وَاقِدٍ، عَنْ عَبْدِ اللَّهِ بْنِ بُرَيْدَةَ، عَنْ أَبِيهِ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ ‏ "‏ مَنْ قَالَ إِنِّي بَرِيءٌ مِنَ الإِسْلاَمِ فَإِنْ كَانَ كَاذِبًا فَهُوَ كَمَا قَالَ وَإِنْ كَانَ صَادِقًا لَمْ يَعُدْ إِلَيْهِ الإِسْلاَمُ سَالِمًا ‏" ‏ ‏.‏

sunnah.com