Motivation for the study. The COVID-19 pandemic contributed to the development of mental disorders among medical students, including obsessive-compulsive symptoms. However, evidence on this problem in this population is still limited. Main findings. One in 10 medical students presented clinically significant obsessive-compulsive symptoms. Implications. The health crisis has had a negative impact on the mental health of medical students. Therefore, it is crucial to implement future interventions to promote the preservation of their psychological well-being. To determine the prevalence of obsessive-compulsive symptoms among medical students in Peru during the COVID-19 pandemic and its associated factors. Cross-sectional study in 270 medical students from a Peruvian public university. Participants were recruited through non-probability sampling. Obsessive-compulsive symptoms were assessed with the Yale-Brown Obsessive Compulsive Disorder Scale (Y-BOCS). After the descriptive analysis, Poisson regression with robust variance was used to determine the factors associated with probable obsessive compulsive disorder (probable OCD). The crude (PRc) and adjusted (PRa) prevalence ratios were calculated, along with their respective 95% confidence intervals (95% CI). The prevalence of obsessive-compulsive symptoms was 13.3% in medical students. During bivariate analysis, students with probable OCD were younger (p=0.044) and had a lower level of knowledge about COVID-19 (p=0.045). The crude model showed a lower prevalence of probable OCD among those with an adequate level of knowledge compared to those with an inadequate level (PR: 0.52, 95% CI: 0.28 to 0.98). However, after adjusting for other variables, none of the described variables were statistically significant. One in ten medical students presented clinically significant obsessive-compulsive symptoms. Implementing future interventions is crucial to preserve the mental well-being of this vulnerable population.