Background: Depression and anxiety are prevalent among post-myocardial infarction (MI) patients, significantly impacting recovery and prognosis. This study aimed to identify predictors of these psychological conditions and evaluate the performance of machine learning (ML) models in their prediction, incorporating clinical, demographic, and heart rate variability (HRV) metrics. Methods: A prospective, single-center observational cohort study was conducted with 70 post-MI patients. Data on demographics, clinical parameters, HRV metrics, and psychological assessments using the Hospital Anxiety and Depression Scale (HADS) were collected. Feature selection was performed using permutation importance, and five ML models (Logistic Regression, Random Forest, XGBoost, Gaussian Naive Bayes, and Support Vector Classifier) were evaluated for their predictive performance. Results: Depression and anxiety were prevalent in 41.43% and 44.29% of patients, respectively, with higher rates observed in women and older age groups. Key predictors for depression included beta-blocker use, heart rate at admission, GRACE score, and HRV metrics (rMSSD). For anxiety, obesity, hypertension, sodium levels, and HRV metrics (SDNN, rMSSD) were significant predictors. Logistic Regression demonstrated the best performance for predicting depression (recall: 0.8, balanced accuracy: 0.713, F1 score: 0.667), while Random Forest and Gaussian Naive Bayes models were most effective for anxiety prediction (F1 scores: 0.546 and 0.625, respectively). Conclusion: This study highlights the potential of ML models, particularly those incorporating HRV measures, in predicting depression and anxiety post-MI. These findings underscore the importance of integrating objective measures like HRV with traditional assessments to enhance early detection and intervention strategies. Future research should focus on validating these models in larger, diverse populations and addressing challenges such as health literacy and standardization of HRV thresholds.