Suicide is a major public health problem caused by a complex interaction of various factors. Major depressive disorder (MDD) is the most prevalent psychiatric disorder associated with suicide; therefore, it is essential to prioritize suicide prediction and prevention within this population. Integrated information from different dimensions, including personality, cognitive function, and social and genetic factors, is necessary to improve the performance of predictive models. Besides, recent studies have indicated the critical roles for EPHX2/P2X2 in the pathophysiology of MDD. Our previous studies found an association of EPHX2 and P2X2 with suicide in MDD. This study is aimed at (1) establishing predictive models with integrated information to distinguish MDD from healthy volunteers, (2) estimating the suicide risk of MDD, and (3) determining the contribution of EPHX2/P2X2. This cross-sectional study was conducted on 472 prospectively collected participants. The machine learning (ML) technique using Extreme Gradient Boosting (XGBoost) classifier was employed to evaluate the performance and relative importance of the extracted characteristics in recognising patients with MDD and depressed suicide attempters (DSA). In independent validation set, the model with clinical and cognitive information could recognise MDD with an area under the receiver operating characteristic curve (AUC) of 0.938 (95% confidence interval (CI), 0.898–0.977), and genetic information did not improve classification performance. The model with clinical, cognitive, and genetic information resulted in a significantly higher AUC of 0.801 (95% CI, 0.719–0.884) for identifying DSA than the model with only clinical information, in which the three single nucleotide polymorphisms of EPHX2 showed important roles. This study successfully established step-by-step predictive ML models to estimate the risk of suicide attempts in MDD. We found that EPHX2 can help improve the performance of suicidal predictive models. This trial is registered with NCT05575713.