Yes, it can be a problem if you feel a strong attraction to someone who is not attracted to you, or is not available to you for some reason. This has been a frequent problem for me.
There are some psychological techniques you can look up and perform by yourself, such as silent ridicule, orgasmic reconditioning and one called repulsion. All of these require you to use your imagination to get your mind to think of that person in different way. They may or may not work.
If you find yourself obsessing over a guy, you have to force your mind to refocus on yourself instead of him.
For me one thing has helped has been for me to remind myself that your sexual activity is basically the same thing from one guy to the next, because most men are built the same way and function the same way. And because it's you as one of the participants in every case. So it's not all that different from one guy to the next. So being with that one guy you're attracted to is not all that different from what you had before or will have later.
In fact, a person who is available and attracted to you is going to be a better experience overall than someone who doesn't want you. The person who is not attracted or interested in you will probably provide a dud of an experience in bed, just because they aren't into you.
And it always helps to remind yourself that all men are really a pile of shit. You may think of him as a god-like creature that holds irresistible appeal to you. But I bet that once you had sex with him, and/or got to know him as a person, you would see his flaws and your attraction to him would sputter and fizzle out. This would happen anyway, so just jump to that stage now.
I don't care how hot he is, the day will come someday when you look at him and say to yourself, "Egad, what was I ever thinking?" Make that day today instead of later on. You need to get to the point where you look at him and think, "Yeah, so what." Anything you can do now to get your mind to that point will help. Concentrate on his flaws.