The current pandemic of the new coronavirus, severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2), or COVID-19, has received wide attention by scholars and researchers. The vast increase in infected people is a significant challenge for each country and the international community in general. The prediction and forecasting of the number of infected people (so-called confirmed cases) is a critical issue that helps in understanding the fast spread of COVID-19. Therefore, in this article, we present an improved version of the ANFIS (adaptive neuro-fuzzy inference system) model to forecast the number of infected people in four countries, Italy, Iran, Korea, and the USA. The improved version of ANFIS is based on a new nature-inspired optimizer, called the marine predators algorithm (MPA). The MPA is utilized to optimize the ANFIS parameters, enhancing its forecasting performance. Official datasets of the four countries are used to evaluate the proposed MPA-ANFIS. Moreover, we compare MPA-ANFIS to several previous methods to evaluate its forecasting performance. Overall, the outcomes show that MPA-ANFIS outperforms all compared methods in almost all performance measures, such as Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), Root Mean Squared Relative Error (RMSRE), and Coefficient of Determination( R 2 ). For instance, according to the results of the testing set, the R 2 of the proposed model is 96.48%, 98.59%, 98.74%, and 95.95% for Korea, Italy, Iran, and the USA, respectively. More so, the MAE is 60.31, 3951.94, 217.27, and 12,979, for Korea, Italy, Iran, and the USA, respectively.