Tomatoes are prone to mechanical damage due to improper gripping forces during automated harvest and postharvest processes. To reduce this damage, a dynamic viscoelastic model based on long short-term memory (LSTM) is proposed to fit the dynamic compression stress relaxation characteristics of the individual fruit. Furthermore, the classical stress relaxation models involved, the triple-element Maxwell and Caputo fractional derivative models, are compared with the LSTM model to validate its performance. Meanwhile, the LSTM and classical stress relaxation models are used to predict the stress relaxation characteristics of tomato fruit with different fruit sizes and compression positions. The results for the whole test dataset show that the LSTM model achieves a RMSE of 2.829×10-5 Mpa and a MAPE of 0.228%. It significantly outperforms the Caputo fractional derivative model by demonstrating a substantial enhancement with a 37% decrease in RMSE and a 36% reduction in MAPE. Further analysis of individual tomato fruit reveals the LSTM model's performance, with the minimum RMSE recorded at the septum position being 3.438×10-5 Mpa, 31% higher than the maximum RMSE at the locule position. Similarly, the lowest MAPE at the septum stands at 0.375%, outperforming the highest MAPE at the locule position by a significant margin of 90%. Moreover, the LSTM model consistently reports the smallest discrepancies between the predicted and observed values compared to classical stress relaxation models. This accuracy suggests that the LSTM model could effectively supplant classical stress relaxation models for predicting stress relaxation changes in individual tomato fruit.