Is it a sin to fantasize haram things in mind and imagination and enjoy it? What is it’s punishment in Islam and how can one control himself or herself from imagining such things!?
It is prohibited to do so and one must ask forgiveness from Allah. Fasting is a good way to control the desires and reminding oneself that Allah is watching.