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.
We advise you not to give yourself up to these whispers and to ward off these ideas. Undoubtedly, safeguarding one's thoughts and occupying oneself only with beneficial religious and worldly matters is one of the most important causes of success.
Fasting is not invalidated by the secretions discharged as a result of such thinking whether it is pre-ejaculatory fluid or vaginal fluid. It was narrated on the authority of Abu Hurayrah that the Prophet, sallallaahu ‘alayhi wa sallam, said: “Allaah has forgiven my Ummah [nation] for their thoughts, unless they are put in action or uttered.” [Al-Bukhari and Muslim]
In principle, the fluid which is discharged after thinking is the pre-ejaculatory fluid. This fluid must be washed out, and one is required to perform ablution. One is not required to perform Ghusl unless there is certainty that the discharged fluid is semen (in the case of a man) or ejaculatory fluid (in the case of a woman).