Several instances of pneumonia with no clear etiology were recorded in Wuhan, China, on December 31, 2019. The world health organization (WHO) called it COVID-19 that stands for "Coronavirus Disease 2019," which is the second version of the previously known severe acute respiratory syndrome (SARS) Coronavirus and identified in short as (SARSCoV-2). There have been regular restrictions to avoid the infection spread in all countries, including Saudi Arabia. The prediction of new cases of infections is crucial for authorities to get ready for early handling of the virus spread. Methodology: Analysis and forecasting of epidemic patterns in new SARSCoV-2 positive patients are presented in this research using metaheuristic optimization and long short-term memory (LSTM). The optimization method employed for optimizing the parameters of LSTM is Al-Biruni Earth Radius (BER) algorithm. Results: To evaluate the effectiveness of the proposed methodology, a dataset is collected based on the recorded cases in Saudi Arabia between March 7 th , 2020 and July 13 th , 2022. In addition, six regression models were included in the conducted experiments to show the effectiveness and superiority of the proposed approach. The achieved results show that the proposed approach could reduce the mean square error (MSE), mean absolute error (MAE), and R 2 by 5.92%, 3.66%, and 39.44%, respectively, when compared with the six base models. On the other hand, a statistical analysis is performed to measure the significance of the proposed approach. Conclusions: The achieved results confirm the effectiveness, superiority, and significance of the proposed approach in predicting the infection cases of COVID-19.