The region of Beni Mellal, Morocco is heavily dependent on the agricultural sector as its primary source of income. Accurate temperature prediction in agriculture has many benefits including improved crop planning, reduced crop damage, optimized irrigation systems and more sustainable agricultural practices. By having a better understanding of the expected temperature patterns, farmers can make informed decisions on planting schedules, protect crops from extreme temperature events, and use resources more efficiently. The lack of data-driven studies in agriculture impedes the digitalization of farming and the advancement of accurate long-term temperature prediction models. This underscores the significance of research to identify the optimal machine learning models for that purpose. A 22-year time series dataset (2000-2022) is used in the study. The machine-learning model auto-regressive integrated moving average (ARIMA) and deep learning models simple recurrent neural network (SimpleRNN), gated recurrent unit (GRU), and long short-term memory (LSTM) were applied to the time series. The results are evaluated based on the mean absolute error (MAE). The findings indicate that the deep learning models outperformed the machine-learning model, with the GRU model achieving the lowest MAE.