Mango farming is an important economic activity in Tanzania, contributing to the economy through exports of mango fruits and products and acting as a primary source of income for many farmers. Maximum temperature is one of the critical weather variables affecting the growth of mango, having an impact both on flowering stages and fruits, so failure to correctly forecast extreme maximum temperature and take appropriate measures may pose challenges such as poor quality of mango fruits and hence low income to farmers. Long Short-Term Memory (LSTM) is one of the famous deep learning models used for forecasting time-series variables such as temperature. In the LSTM model, an optimizer is a very important component as it is used to minimize loss during model training. Despite there being a number of optimizers, which can be used in the LSTM model, there is still a research gap, on which one is the best-performing optimizer in forecasting tasks, especially in the context of forecasting maximum temperature in Koga farm, a mango farm located in Mkuranga district, Pwani region, Tanzania which has unique climatic conditions and has a small geographical area. This study aims to fill this gap by comparing the performances of common LSTM optimizers and developing an LSTM model for helping Koga farm officials forecast daily maximum temperature using the best-performing optimizer. The experimental findings reveal that Adam and Adamax are the two best-performing optimizers with both having Root Mean Squared (RMSE) values of 0.089 on the test set (unseen data). The performance of the remaining optimizers on the test set with their RMSE values in brackets are as follows; RMSprop (0.091), Adagrad (0.099), SGD (0.102) and Adadelta (0.107). This study recommends that software developers and researchers use either Adam or Adamax optimizer in LSTM models when forecasting temperature in environments which resemble that of the Koga farm in Tanzania.