PurposeThis research employs machine learning and mediation analysis, along with path analysis, to investigate the correlations between factors such as body mass index (BMI) and the occurrence of diabetes and heart disease among the Indian population. The objective is to enhance models that are specifically designed to accommodate lifestyles, genetic differences, and healthcare obstacles.MethodsOur research combines a range of data that includes aspects such as lifestyle, physical health, and mental well-being. We use mediation and path analysis techniques to identify the factors involved in the process, while also utilizing machine learning classifiers to enhance risk assessment. In addition to considering known risks, we also investigate biomarkers. Incorporate time factors through analyses.ResultsMediation and path models analyze that diabetes and heart disease are partially mediated with their coefficients a = 7.85, b = 0.01, and c-c' = 0.10. In the path analysis model, the standardized values of exposure and outcome variables are 4.14 and 6.85, respectively, showing a significant relationship with the mediator and other covariates. In classification, the Random Forest classifier shows 99% accuracy and precession, while the Decision Tree, Extra Tree, K-Nearest, and Adaboost classifiers have an accuracy of 98%, 97%, 96%, and 95%, which shows that the machine learning classifiers are more significant for the study.ConclusionThis study contributes to the development of risk management for diabetes and heart disease in India by utilizing machine learning and mediation analysis. It examines relationships, such as BMI, to provide insights for targeted measures, thereby contributing to global discussions on health.