An emergency department (ED) is a specialized area where patients usually arrive in critical condition and require immediate care. Medical staff know that in these cases reacting quickly is crucial for saving patients' life. Since supplies, personnel and infrastructure are limited resources, the efficiency in their use is fundamental to operate adequately. Therefore, planning well in advance is fundamental to optimize the use of the existing resources. This research presents an interesting approach to forecast the number of patients received at the ED of a public hospital by means of implementing and comparing model bases in machine learning algorithms. This investigation was carried out following a 4-phase methodology: analysis, design, development, and validation. During the phase of analysis, the ED database with recorded collected during 2020 was reviewed and preprocessed. Data were prepared and organized to show number of patients visiting ED every day. During the phase of design, machine learning algorithms for forecasting were analyzed and compared. Among others: linear regression, artificial neural network, machine support vectors, and Gaussian methods. The development and the validation phases were carried out entirely using the data processing software WEKA 3.9.6 with the forecasting package version 1.1.27. In total, over seventy thousand records corresponding to ED visits occurred during 2020 were used in the investigation. Data were divides in two datasets: one for building forecasting models and another one for comparing predicted and actual values. Six forecasting horizons were study: 60, 45, 30, 15, 10, and 6 days. For each horizon four machine learning algorithms were used to predict the number of ED visits. To evaluate and compare predictions, the usual error metrics were considered: MAE, MSE, RMSE, and MAPE. Forecasting results revealed notorious differences in the accuracy of the predicted values. Although no big differences are noticeable when forecasting short periods, the prediction error is considerable when forecasting a long period of 60 days. In this case, MAPE fluctuated between 39% and 16% depending on the algorithm. When forecasting short periods, for instance 5 days, MAPE varied between 17% and 14%. In conclusion, experimental results showed that ML-based forecasting algorithms can be used to predict the number of ED visits with accuracy even when with long forecasting horizons. The application of such approach might be of great help to estimate resource requirements and to support decision making.