All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The whispers that are related to religious matters and come to a person’s mind, and he experience self-talk about those matters, and he has no power in getting rid of it, then it is what Allah forgives for human beings, unless the person acted upon these whispers or talked about them, as in Sahih Muslim in the Hadith narrated on the authority of Abu Huraira that the Messenger of Allah observed: “Verily Allah has forgiven my nation for the whispers that they have as long as they do not speak about it or act according to it.” [Muslim]
The person is held accountable only based on acting upon the whispers or speaking about them, and as long as it is self-talk, it is forgiven even if a person is carried away with it, but continuing to get carried away with it may harm him; and therefore, these thoughts should be avoided as much as possible. Therefore, if you try to avoid it, it will not harm you – Allah willing – especially when you hate it and you consider it to be grave out of fear of uttering it, let alone believing in it. These feelings are evidence of faith. It is narrated on the authority of Abu Huraira that some people from amongst the Companions of the Prophet came to him and said: “Verily we perceive in our minds that which every one of us considers it too grave to express. He (the Prophet) said: ‘Do you really perceive it? They said: ‘Yes.’ Upon this he remarked: ‘That is the faith manifest.” [Muslim]
We advise the questioner to remember Allah as much as possible, and to occupy himself with thinking about what will benefit him in this world and in the Hereafter. If he faces any of these whispers related to his faith, then let him avoid it, and let him say: “I believe in Allah”.
For more benefit, please refer to Fataawa 88597 and 90226 about the whispers that do not affect the belief and Fatwa 85823 about how to treat doubts and whispers.
Allah knows best.