This paper addresses the problem of predicting insulin dosage in diabetes patients using the PSO-LSTM, COA-LSTM, and LOA-LSTM algorithms. Accurate insulin dosage prediction is crucial in effectively managing Diabetes and maintaining blood glucose levels within the desired range. The study proposes a novel approach that combines particle swarm optimization (PSO) with the long short-term memory (LSTM) model. PSO is used to optimize the LSTM's parameters, enhancing its prediction capabilities specifically for insulin dosage. Additionally, two other techniques, COA-LSTM and LOA-LSTM, are introduced for comparison purposes. The algorithms utilize a dataset comprising relevant features such as past insulin dosages, blood glucose levels, carbohydrate intake, and physical activity. These features are fed into the PSO-LSTM, COA-LSTM, and LOA-LSTM models to predict the appropriate insulin dosage for future time points. The results demonstrate the effectiveness of the proposed PSO-LSTM algorithm in accurately predicting insulin dosage, surpassing the performance of COA-LSTM and LOA-LSTM. The PSO-LSTM model achieves a high level of accuracy, aiding in personalized and precise insulin administration for diabetes patients. By leveraging the power of PSO optimization and LSTM modeling, this research improves the accuracy and reliability of insulin dosage prediction. The findings highlight the potential of the PSO-LSTM algorithm as a valuable tool for healthcare professionals in optimizing diabetes management and enhancing patient outcomes.