Diabetes, a chronic disease, arises when the body is either unable to utilize the insulin generated by the pancreas or is unable to create enough of it. It could be the deadliest if left undiagnosed and untreated. If diabetes is identified early enough, a person can receive the right care and live a healthy life. An automated system is required to identify diabetes from clinical and physical data when the traditional method is laborious. The paper proposed a new diabetes classifying model based on optimized long short-term memory (LSTM). The proposed method uses a new variant of particle swarm optimization (PSO) based on partial opposition-based learning (POBL) and a local search algorithm (LSA) approach called PLPSO for optimizing hyperparameters of LSTM (PLPSO-LSTM). PSO uses the POBL during the initialization phase to increase population diversity and the LSA during the updating position to increase exploitation. The proposed model has been tested using four diabetes datasets for analyzing its performance. These results show that optimized PLPSO-LSTM performs better than other state-of-the-art algorithms.