Obsessions Found in Pure OObsessive Compulsive Disorder (OCD) is a condition which someone has strong desire (obsession) to do something repeatedly because feel anxious exaggerated. In example, washing hands repeatedly because afraid of germ, checking the door repeatedly to make sure it has been locked. Behavior like this is not sin.
But thinking and imagining the immoral things?. Hmm, ...... I don't think this is symptom of OCD. It's better if you do not too easy to conclude that this is symptom of OCD.