The emergence of the coronavirus disease 2019 (COVID-19) pandemic has caused great fear and panic around the world. In order to fight the COVID-19 virus, countries have had to develop some vaccines and drugs. Unfortunately, the effectiveness of these vaccines and drugs has diminished significantly due to the frequent mutations of the COVID-19 virus. Therefore, if future mutations on the Spike (S) protein of the COVID-19 virus can be predicted, vaccines and drugs can be developed faster and the fight against the COVID-19 virus can be easier. As in every field, artificial intelligence (AI)-based approaches also offer promising results in COVID-19 mutation prediction. However, finding the best hyperparameter value to improve the performance of each AI-based approach is quite difficult. In this study, we propose a robust StackGridCov model to predict future mutations on the COVID-19 virus. We utilize GridSearchCV hyperparameter tuning algorithm to improve the performance of the proposed StackGridCov model. Our main aim is to predict future mutations on the COVID-19 virus using the proposed StackGridCov model. In addition, to evaluate the performance of the proposed StackGridCov model, we carry out mutation prediction on the previously emerged influenza A/H1N1 HA virus dataset. The experimental results show that the proposed StackGridCov model outperforms 0.6623 accuracy, 0.6723 F1-score and 0.3273 MCC both the literature and other models. The results indicate that the proposed StackGridCov model can make a reliable contribution to predict mutations in both COVID-19 virus datasets and influenza A/H1N1 HA virus dataset. © The Author(s), under exclusive licence to Springer-Verlag London Ltd., part of Springer Nature 2024.