BackgroundThe coronavirus pandemic and health measures related to it have led to an increase in mental health problems. The relatively high incidence of the disease and its mortality rate created anxiety in society. This study aimed to determine the prevalence of fear of the coronavirus (COVID-19) and its relationship with obsessive–compulsive disorder in patients who attended the outpatient clinic of Besat Hospital in Hamadan.MethodsIn this cross-sectional descriptive study, 320 patients who attended the outpatient clinic of Besat Hospital in Hamadan were selected by random sampling method in 2021. Data were collected using the Fear of the coronavirus (COVID-19) questionnaire and obsessive–compulsive disorder scale and analyzed using SPSS software (V16). They were analyzed using Pearson correlation coefficient and independent t-test.ResultsThe mean ± SD age of the subjects was 34.14 ± 9.30 years and 65% of the study subjects were women. The mean ± SD score on the obsessive–compulsive disorder scale was 32.90 ± 19.87 and the mean ± SD score for fear of coronavirus was 16.82 ± 5.79. The contamination dimension of OCD had the highest score of 9.04 ± 5.46 and stealing had the lowest score of 0.10 ± 0.49. The mean fear of COVID-19 in people who had a history of obsessive–compulsive disorder before the quarantine was significantly higher than in those who did not have it (P = 0.002). Along with the increasing fear of coronavirus scale score, the score of obsessive–compulsive disorders increased except for the stealing dimension (P < 0.001).ConclusionsThe results of the study showed that there was a moderate level of fear of COVID-19 among the study population. Also, a relatively high proportion of study subjects had a weak manifestation of OCD. It seems that two years after the beginning of the Covid-19 coronavirus pandemic, people have adapted to the conditions, and their fear of the disease is reduced.