Atherosclerotic cardiovascular disease (ASCVD), which includes coronary heart disease (CHD) and ischemic stroke, is the leading cause of mortality globally. According to the European Society of Cardiology (ESC), 26 million people worldwide have heart disease, with 3.6 million diagnosed each year. Early detection of heart disease will aid in lowering the mortality rate. The lack of diversity in training data and the difficulty in comprehending the findings of complicated AI models are the key issues in current research for heart disease prediction using artificial intelligence. To overcome this, in this paper, cardiac disease prediction using AI algorithms with SelectKBest has been proposed. Features are standardized, balanced, and selected using the StandardScaler, SMOTE, and SelectKBest techniques. Machine learning models such as support vector machine (SVM), K-nearest neighbor(KNN), decision tree (DT), logistic regression (LR), adaptive boosting (AB), naive Bayes (NB), random forest (RF), and extra tree (ET) and deep learning models such as vanilla long short-term memory (LSTM), bidirectional long short-term memory (LSTM), stacked long short-term memory (LSTM), and deep neural network (DNN) are assessed using Alizadeh Sani, combined (Cleveland, Hungarian, Switzerland, Long Beach VA, and Stalog), and Pakistan heart failure datasets. As a result of the evaluation, the proposed deep neural network (DNN) with SelectKBest predicted heart disease in a promising way. The prediction rate of unweighted accuracy of 99% on Alizadeh Sani, 98% on combined, and 97% on Pakistan are gained in tenfold cross-validation experiments. The suggested approach can be utilized to diagnose heart disease in its early stages.© 2023. International Federation for Medical and Biological Engineering.