The Messenger of Allah ﷺ said, "Whoever swears an oath saying, 'I am free from Islam,' if he is lying, then he is as he said, and if he is truthful, he will not return to Islam unscathed."
حدثنا أحمد بن حنبل حدثنا زيد بن الحباب حدثنا حسين يعني ابن واقد
قال رسول الله ﷺ من حلف فقال إني بريء من الإسلام فإن كان كاذبا فهو كما قال وإن كان صادقا فلن يرجع إلى الإسلام سالما
[Its isnad is hasan] Ibn Majah narrated it in the Book of Expiations, chapter "Whoever swears by a religion other than Islam," no. 2100, and Nasai, no. 3803, from the hadith of Husayn bin Waqid, with this wording. It is also found in Musnad Ahmad, 5/355, and Hakim graded it sahih according to the standard of the two Shaykhs, 4/398, and Dhahabi agreed with him.