Abstract Aim: During the major waves of coronavirus disease 2019 (COVID-19) infection, Peru had the highest case fatality rate in the world. This situation may have caused psychological conditions with somatic consequences in students who were susceptible to infection due to exposure to infected patients. The present study was designed to investigate the association between anxiety levels and painful temporomandibular disorders in dental students from two Peruvian provinces during the major waves of COVID-19 infection. Materials and Methods: The study conducted was both longitudinal and analytical. The total population consisted of 558 dental students from Peru, with 314 from Chimbote and 244 from Trujillo. No sample size calculation was necessary as the entire student population was invited to participate. Of the 366 students who initially joined the closed cohort, only 204 remained at the end of the study. During the first and second waves of COVID-19 infections, the Zung anxiety diagnostic test and the diagnostic criteria for painful temporomandibular disorder (DC/TMD) triage questionnaire were used to assess anxiety levels. The study also evaluated variables such as sex, age, marital status, academic year of study, area of residence, housing type, and occupation. The study employed statistical analysis to determine the relative risk (RR) of painful TMD incidence during the first and second waves of COVID-19 infections. A logit model was also used to determine the presence of painful TMD, with odds ratio (OR) as the measure. The statistical significance level was set at P < 0.05. Results: During the initial wave of COVID-19 infections, 50% (95% CI: 43.1–56.9%) of the 204 students experienced anxiety, while 26.5% (95% CI: 20.4–32.6%) reported TMD. Furthermore, those who exhibited anxiety were eight times more likely to develop TMD (OR = 8.88, 95% CI: 3.95 - 19.97). In the second wave, 62.3% (95% CI: 55.6–69.0%) of students reported anxiety, and 86.3% (95% CI: 81.6–91.0%) reported TMD. Additionally, individuals with anxiety were found to have a significantly higher likelihood of developing painful TMD, with a nine-fold increase in risk (OR = 9.87, 95% CI: 5.08–19.19). The cohort of students exposed and not exposed to anxiety during the first and second waves of COVID-19 infection showed a 4.58 times higher risk (95% CI: 2.61–8.03) of developing painful TMD due to anxiety. Conclusion: Between the first and second waves of COVID-19 infection, the prevalence of anxiety and painful temporomandibular disorder (TMD) increased among dental students. This establishes anxiety as a significant predisposing factor for the development of painful TMD over time.