What is the ruling regarding a person who has thoughts of disbelief but never utters them or believes in them?
All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
There is no sin upon a person who unwillingly thinks of the words of disbelief while in his heart he renounces them. Allaah Says (what means): {Our Lord, do not impose blame upon us if we have forgotten or erred.} [Quran 286:2] If this is just a thought which is not translated into words or actions, Allaah The Almighty forgives it. The Prophet, sallallaahu ‘alayhi wa sallam, told us that Allaah The Almighty does not hold Muslims accountable for the sinful acts that unwillingly occur in their minds except if these sins are enacted or uttered. [Al-Bukhari and Muslim]
At the same time, the person has to stop thinking like this whenever it comes to his mind, and must seek refuge with Allaah The Almighty from the accursed Satan.
Allaah Knows best.
You can search for fatwa through many choices