IntroductionMicronutrients have significant functional implications for the human immune response, and the quality of food is a major factor affecting the severity and mortality caused by HIV in individuals undergoing antiretroviral therapy. A decrease in CD4 lymphocyte count and an increase in CD8 lymphocyte count are the hallmarks of HIV infection, which causes the CD4/CD8 ratio to invert from a normal value of >1.6 to <1.0. In this study, we tried to analyze whether the nutritional status of HIV-positive patients has an impact on the CD4/CD8 ratio inversion by utilizing a machine learning (ML) algorithm.MethodsIn this study, 55 confirmed HIV-positive patients who had not started their anti-retroviral therapy were included after obtaining their informed, written consent. Moreover, 55 age-and sex-matched relatives and caregivers of the patients who tested negative in the screening were enrolled as controls. All individual patient data points were analyzed for model development with an 80–20 train–test split. Four trace elements, zinc (Zn), phosphate (P), magnesium (Mg), and calcium (Ca), were utilized by implementing a random forest classifier. The target of the study was the inverted CD4/CD8 ratio.ResultsThe data of 110 participants were included in the analysis. The algorithm thus generated had a sensitivity of 80% and a specificity of 83%, with a likelihood ratio (LR+) of 4.8 and LR-of 0.24. The utilization of the ML algorithm adds to the limited evidence that currently exists regarding the role of micronutrients, especially trace elements, in the causation of immune risk. Our inherent strength lies in the fact that this study is one of the first studies to utilize an ML-based decision tree algorithm to classify immune risk in HIV patients.ConclusionOur study uniquely corroborated the nutritional data to the immune risk in treatment-naïve HIV patients through the utilization of a decision tree ML algorithm. This could subsequently be an important classification and prognostic tool in the hands of clinicians.