The Messenger of Allah ﷺ said, "Whoever says, 'I am free of Islam,' if he is lying, then he is as he said, and if he is truthful, he will not return to Islam safe and sound."
أخبرنا الحسين بن حريث قال حدثنا الفضل بن موسى عن حسين بن واقد
قال رسول الله ﷺ من قال إني بريء من الإسلام فإن كان كاذبا فهو كما قال وإن كان صادقا لم يعد إلى الإسلام سالما
[Its isnad is hasan] Ibn Majah narrated it in the Book of Expiations, chapter "One who swears by a religion other than Islam," no. 2100, from the hadith of Fadl bin Musa through this route. It is also in the Kubra, no. 4713. Hakim graded it sahih according to the criteria of the two Shaykhs, 4/298, and Dhahabi agreed with him.