The imam of my local mosque told me that there is a big diference betwen thinking something bad about Allah his messengers and the close circle of sahabah and thinking something bad about ordinary creatures of god.If you imagine something bad about Allah it is kufr even if you don’t believe it.If you imagine something bad about ordinary creatures you have no sin until you act upon it.Do you agree?
Wa’alaykum as Salam wa rahmatullahi wa barakatuhu,
If a thought comes to your mind involantarily about Allah, there will be no harm.
On the contrary, volantarily having bad thoughts and assumptions about others is a sin. For example,we see a person eating in Ramadhaan. We should make an excuse for him; like he might be a diabetic or a traveler. To think bad about him is incorrect.
And Allaah Ta’aala knows best
Ismail Moosa (Mufti)