Rice serves as a fundamental food staple for humans. Its production process, however, unavoidably exposes it to pesticides which may detrimentally impact its quality due to residues. Therefore, it is extremely necessary to monitor pesticide residues on rice during storage. In this research, the Quatformer model, which considers the effects of temperature and humidity on pesticide residues in rice grains, was utilized to forecast the amount of pesticide residues in rice grains during the storage process, and the predicted results were combined with actual observations to form a quality assessment index. By applying the K-Means algorithm, the quality of rice grains was graded and assessed. The findings indicated that the model had high prediction accuracy, and the MAE, MSE, MAPE, RMSE and SMAPE indexes were calculated to be 0.0112, 0.0814, 0.1057, 0.1055 and 0.0204, respectively. These findings provide valuable technical and theoretical support for planning storage conditions, enhancing pesticide residue decomposition, and monitoring rice quality during storage.