There is a statement said, “The people who only know Allāh in Ramaḍān will not be successful.” Is this statement a ḥadīth?

Shaykh ʿAbd al-ʿAzīz ibn Bāz:

This is a statement from the some of the Salaf. They mentioned this about a people who worship Allāh ﷻ in Ramaḍān. And when Ramaḍān ends, they stop, So the Salaf said, ‘How miserable is a person who only knows Allāh in Ramaḍān‘. This statement is correctly referred to  a person who leaves performing the obligations and it is not referring to a person who doesn’t continue to perform the voluntary acts outside of Ramaḍān. This statement is correct.

However the intent behind it, is the people who only perform the obligations of Allāh ﷻ temporarily.  Meaning, they pray in Ramaḍān and leave it in the remaining eleven months.

This person is wrecked because he has disbelieved due to this, since intentionally leaving the prayer is disbelief. As for not performing some voluntary acts outside of Ramaḍān is not sinful. Since People during Ramaḍān strive greatly to perform various acts of the recommended acts, charity and other similar things. So if he falls short in performing these acts after Ramaḍān we do not say he is wrecked.