This paper proposes a methodology consisting of two phases: attributes selection and classification based on the attributes selected. Phase 1 uses the introduced new feature selection algorithm which is the optimal mayfly algorithm (OMA) to solve the feature selection technique problem. Mayfly algorithm has derived features of physiological and anatomical relevance, like ST depression, the highest heart rate, cholesterol, chest pain, and heart vessels. In the second phase, the selected attributes use the ensemble classifiers like random subspace, bagging, and boosting. Optimal mayfly algorithm (OMA) with boosting technique had the highest accuracy. Therefore, true disease, false disease, accuracy, and specificity are measured to evaluate the proposed system's efficiency. It has been discovered that the proposed method, which combines feature selection and ensemble techniques performs well, the performance of the optimal mayfly algorithm along with ensemble classifiers of boosting method with a model accuracy of 97.12% which is the highest accuracy value compared to any single model.