Deformation prediction is an important part of concrete dam safety monitoring. In recent years, the random forest (RF) algorithm has attracted more and more attention in the field of dam safety monitoring because of its fast speed and strong generalization ability. However, the performance of RF is easily affected by many factors, such as the drift of measured value in displacement and the inappropriate setting of parameters of RF. To solve the above problems, the indicator variable model (IVM) is used to identify and eliminate the drift of measured values in this paper, and the sand cat swarm optimization (SCSO) is applied to optimize RF for the first time. On the grounds of this, a deformation prediction system of a concrete dam based on the IVM and RF algorithm optimized by SCSO is proposed. The case study shows that IVM can correct the interference of monitoring data accurately, and the maximum error rate is less than 3%; in the aspect of parameter optimization of RF, the results of the SCSO algorithm are obviously better than those of the TAE method and PSO algorithm, and the corresponding OOB error is the minimum; in terms of prediction performance, compared with TAE-RF, PSO-RF, LSTM and SVM, SCSO-RF has higher accuracy and stronger stability, and its SSE and MSE are reduced by at least 91%, MAE and RMSE are reduced by at least 71%, and R2 is very close to 1. The results of study provide a new method for the automatic online evaluation of dam safety performance.