The aim of the study was to identify the risk factors associated with nonsuicidal self-injurious (NSSI) behavior in patients with depressive disorders and develop predictive models utilizing these influencing factors as predictors, followed by validation of the constructed models for their efficacy. Patients with depression disorders admitted to Wuhan Mental Health Center from 2020 to 2021 were included using retrospective analysis. Patients who exhibited one or more items on the NSSI behavior rating questionnaire were categorized into the NSSI group, while those without any such behaviors were assigned to the non-NSSI group. Patients in both groups were categorized separately based on gender, age, personality traits, and interpersonal relationships. The above data were analyzed using multiple logistic regression analysis. Prediction models were constructed, receiver operating characteristic (ROC) curves were produced and model accuracy was calculated. A total of 237 patients were included in this study, with 122 patients assigned to the NSSI group and 115 patients assigned to the non-NSSI group. By comparing the baseline data of the patients in the 2 groups, the results revealed statistically significant differences between the 2 groups in terms of age, grades at school, early childhood parenting style, Hamilton Depression Rating Scale (HAMD), Hamilton Anxiety Scale (HAMA), and Experiences in Close Relationships Scale (ECRS) (P<.05). However, no statistically significant differences were observed for the remaining indicators (P>.05). The results of the multiple logistic regression model showed that grades at school, early childhood parenting style, HAMD, HAMA, and ECRS scores were risk factors. The ROC model was constructed using school performance, childhood parenting style, HAMD, HAMA, and ECRS scores as predictors. The findings indicated that the ECRS score was the best predictor of NSSI, and it had a sensitivity of 91.8% and specificity of 70.5% for an area of 0.967. ECRS was utilized as a predictor to evaluate the NSSI inclination of depressed patients with commendable sensitivity and specificity. Furthermore, early childhood parenting style, HAMD, HAMA, and ECRS scores were identified as risk factors for NSSI. For individuals at high risk who exhibit these aforementioned risk factors, clinical diagnosis and treatment should be approached with caution.