What is the status of the hadith, “الناس كلهم هالكون الاالعالمون الخ” “All people are destroyed except the ulama”?
Answer: حامدا ومصليا ومسلما
The complete wording is as follows:
الناس كلهم موتى إلا العالمون والعاملون كلهم هلكى إلا العاملون، والعاملون كلهم غرقى إلا المخلصون، والمخلصون على خطر عظيم
“All the people are dead except the ulama and all the ulama are destroyed except the ones who practice and all those who practice are drowned except the sincere ones and the sincere ones are in grave danger.”
It is incorrect to ascribe this statement to the Messenger of Allah ﷺ. Allamah Saghani said, “This hadith is fabricated and grammatically incorrect. The correct e’raab is: الا العالمين والعاملين والمخلصين”
Hafiz Muhammad Tahir Patni, Imam Al-A’jluni, and Allamah Shawkani have agreed with this classification in their respective books on famous or fabricated ahadith. After listing the above narration, Shaikh Muhammad Al-Hut said, “[It is] fabricated. As-Samarqandi mentioned this hadith in the book ‘Tanbeehul Ghafileen’ and the orators took a liking to it. This book has many fabrications in it, so it cannot be relied upon.” 
However, the statement is also ascribed to the famous ascetic, Shaikh Dhun-Noon Al-Misri. Hafiz Ibn Asakir narrates it from him in his ‘Tarikh Dimashq’:
الناس كلهم موتى إلا العلماء والعلماء كلهم نيام إلا العاملون والعاملون كلهم مغترون إلا المخلصون والمخلصون على خطر عظيم قال الله عز وجل “ليسأل الصادقين عن صدقهم”.
“All people are dead except the ulama and all the ulama are asleep except the ones who practice and all those who practice are fooled except the sincere ones and the sincere ones are in grave danger. Allah azza wa jalla says, ‘That He may question the truthful about their truth.’”
Many scholars have used this statement and it has a correct meaning. However, it is incorrect to ascribe it to the Prophet ﷺ.