BackgroundThe Covid-19 pandemic has affected all areas of society, including students. However, medical students have faced many challenges due to direct contact with patients. The present study was conducted with the aim of investigating and comparing the quality of life (QoL), anxiety and mindfulness between Iranian medical and non-medical students during the COVID-19 pandemic.MethodFive hundred and six students (both medical and non-medical students) participated in the study from August to October 2022 with a convenience sampling method. The data were collected using an online questionnaire including a demographic form, the QoL Questionnaire (WHOQOL- BREF), the Generalized Anxiety Disorder 7-item survey (GAD‐7) and the Relaxation/Meditation/Mindfulness Tracker t-Persian version survey (RMMt-P). Pearson correlation and independent t-test and multivariate linear regression were used to determine the relationship between the study variables.ResultsThe samples included 272 medical students and 234 non-medical students with a mean age of 21.99 ± 3.46 and 24.17 ± 6.54 years respectively. Most of the medical and non-medical students were female, single and had a bachelor’s degree. The mean scores of medical and non-medical students’ QoL during the COVID-19 pandemic were 57.86 ± 13.26 and 56.75 ± 14.42, respectively which indicates the higher quality of life of medical students. Anxiety and mindfulness predicted 29% of the variance of the QoL in the medical students, while anxiety and mindfulness and having a chronic disease predicted 30% of the variance of the QoL in the non-medical students. No significant difference existed in the QoL and its subscales during the COVID-19 pandemic between medical and non-medical students (p > 0.05). There was a significant difference in terms of anxiety (p = 0.02) and mindfulness (p = 0.03) between medical and non-medical students during the prevalence of COVID-19.Discussion and conclusionThe findings of the present study indicated that medical students exhibited lower levels of anxiety and higher levels of mindfulness. Therefore, interventions aimed at reducing anxiety and increasing mindfulness among non-medical students are necessary. It is recommended that preventive approaches and psychological interventions to improve students’ quality of life become an integral part of crisis response during the COVID-19 pandemic. Additionally, reducing anxiety and enhancing mindfulness can improve the quality of education and professional performance of medical students, while also contributing to their mental well-being and effective clinical communication.