Are we allowed to think about sex with someone whom we are not yet married to? Imagining marital sexual relations?

If the sexual fantasy intentional, then yes there is a problem in indulging in such fantasies