Among medical residents, suicide is the second most prevalent cause of mortality. In Iran, the suicide of medical residents has become one of the most important challenges. This study aimed to investigate the mediating role of psychological distress in the relationship between perfectionism and suicidal ideation among medical residents in Iran. This research was a descriptive-correlational study based on structural equation modeling. The statistical population of the present research included all the residents in Shahid Beheshti University of Medical Sciences (SBMU) in 2023, of whom 277 people were selected as a sample using the available sampling method. The Beck Scale for Suicidal Ideation (BSSI-1997), the Tehran Multidimensional Perfectionism Scale (TMPS-2007) and the Depression, Anxiety and Stress Scale (DASS-21-1995) were used to collect the data. Data was analyzed using structural equation modeling with SPSS and Amos software version 22. Out of 277 participants, 30% (N = 83) were male and 70% (N = 194) were female. The findings showed that the research model had goodness of fit. There was a significant relationship between perfectionism and psychological distress (β = 0.76, P < 0/001) and between psychological distress and suicidal thoughts (β = 0.66, P < 0/001). However, there was no direct relationship between perfectionism and suicidal ideation (P > 0.01), but perfectionism played a role in residents' suicidal ideation through psychological distress (β = 0.50, P < 0/001). In other words, perfectionism led to suicidal ideation by increasing the psychological distress of the residents. In addition, perfectionism and psychological distress were able to explain 42% of the variances of suicidal ideation (R2 = 0/42). The results highlighted the crucial role of psychological distress in suicidal ideation of medical residents. Accordingly, substantial support from health-sector managers and policymakers is essential to meet the requirements of medical residents.