The COVID-19 pandemic has altered the educational environment of medical students in clinical clerkship, with potential impacts on clinical competency and reported increased prevalence of depression. This study aimed to determine the relationship between the perception of the educational environment, self-perceived clinical competency, and depression among them. Subjects (N = 196) at the National University of Malaysia participated through convenience sampling in an online survey including sociodemographic data, COVID-19-related stressors, Dundee Ready Education Environment Measure (DREEM), self-perceived clinical competency, and Patient Health Questionnaire (PHQ-9). The cut-off point for depression was a PHQ-9 score ≥ 15. Multiple logistic regression followed bivariate analyses to identify factors for depression. The participants (mean age: 23.2 years, SD ± 0.98 years) were mainly female (71.9%) and Malay (59.2%). The prevalence of depression was 17.4% (95% CI: 12.3–23.4%). Most participants perceived the educational environment positively. In logistic regression, ethnicity (Adjusted OR = 3.1, 95% CI: 1.2–8.1) and DREEM score were significantly associated with depression, whereas self-perceived clinical competency was not. A higher DREEM score indicating a better perception of the educational environment was linked to a lower likelihood of depression (p = 0.046). Besides ethnicity, perception of the educational environment emerged as a factor associated with depression. This relationship between the educational environment and mental well-being warrants further exploration.