Thank you for having the courage to speak about this identity and anxiety concern. There is a history in psychology of classification of this type of anxiety. It is no longer part of the diagnostic and statistical manual (the diagnostic reference tool for clinicians published by the American Psychiatric Association), but had once been referred to as a homosexual panic, or as Kempf’s disease. It also had some impact on the legal profession which is also no longer used.
I only mention the history for a reference point that people have struggled with the anxiety over their sexual identity for a long time. Your focus on the internal struggle is where I would put your effort. Thinking you are a bad person for having these thoughts, or being unable to manage sexually intrusive thoughts, is where the anxiety can best be managed. For this, I would recommend Cognitive Behavioral Therapy. Here is some information put out by the Association for Behavioral and Cognitive Therapies. Therapists who work in this modality are able to help you with strategies for challenging these intrusive thoughts.
Wishing you patience and peace,
Proof Positive Blog @ PsychCentral