Osteoporosis (OP) is characterized by diminished bone mass and deteriorating bone structure that increases the chance of fractures in the spine, hips, and wrists. In this paper, a novel data processing method of artificial intelligence (AI) is used for evaluating, predicting, and classifying OP risk factors in clinical data of men and women separately. Additionally, artificial intelligence was used to suggest the most appropriate sports programs for treatment. Data was obtained from dual-energy x-ray absorption scanning center of Ayatollah Kashani, Milad, and Khatam al-Anbia hospitals in Tehran, Iran. The subjects included 1224 men and women. Models were developed using decision tree, random forest (RF), k-nearest neighbor, support vector machine, gradient boosting (GB), Extra trees, Ada Boost (AB), and artificial neural network multilayer perceptron analysis to predict osteoporosis and to recommend sports programs. Data was divided into training (80%) and test dataset (20%). The results were obtained on a 20% test dataset. Area under receiver operating characteristic curve (AUROC) was used to compare the performance of the models. To predict healthy individuals, osteopenia and osteoporosis, the FR algorithm with AUROC 0.91 performed best in men and the GB algorithm with AUROC 0.95 performed best in women compared to other classification algorithms. Prediction of RF algorithm in women and men with AUROC 0.96 and 0.99, respectively, showed the highest performance in diagnosing the type of exercise for healthy individuals and those with osteopenia and OP. Eight AI algorithms were developed and compared to accurately predict osteoporosis risk factors and classify individuals into three categories: healthy, osteopenia, and OP. In addition, the AI algorithms were developed to recommend the most appropriate sports programs as part of treatment. Applying the AI algorithms in a clinical setting could help primary care providers classify patients with osteoporosis and improve treatment by recommending appropriate exercise programs.