Meteorological conditions play an important role in China's national production, and the accurate prediction of precipitation is of great significance for social production, flood prevention, and the protection of people's lives and property. A coupled model for monthly rainfall prediction is constructed based on the convolutional neural network (CNN) and the bi-directional long- and short-term memory network (BILSTM) combined with a sparrow optimization algorithm incorporating positive cosine and Cauchy variants (SCSSA). The model combines the SCSSA optimization algorithm with the CNN-BILSTM model, capturing data features in data space as well as temporal dependencies through CNN-BILSTM to predict the relationship. Additionally, the model combines SCSSA's excellent global search capability and convergence speed to further improve the accuracy of model prediction. Based on the measured monthly rainfall data of Xi'an City from 1996 to 2020, the SCSSA-CNN-BILSTM model was compared with the SSA-CNN-BILSTM, SCSSA-BILSTM, and CNN-BILSTM models. The results show that all the evaluation indicators of the SCSSA-CNN-BILSTM model are optimal and the prediction accuracy is the highest. This shows that the proposed SCSSA-CNN-BILSTM model has high accuracy in monthly rainfall prediction and provides a new method for hydrological rainfall model predictions.