The thermal error of the motorized spindle is an essential factor affecting the machining accuracy of high-speed CNC machines. The establishment of a high-speed motorized spindle thermal error model for thermal error compensation can effectively improve the impact of thermal errors on the machining accuracy of the machine tool. This paper proposes a sparrow search algorithm to optimize the Elman neural network to predict thermal errors in motorized spindles. First, thermal characteristics of the A02 high-speed motorized spindle were analyzed using ANSYS Workbench software. Based on the simulation results, the position of the temperature measuring points is arranged in the temperature and thermal error experiment of the motorized spindle. The temperature and thermal displacement data of high-speed motorized spindle at different rotational speeds were collected; Secondly, the method of combining pedigree clustering and k-means clustering is used to perform cluster analysis on each temperature measurement point, and the grey correlation degree is used to determine the correlation between temperature measurement points and thermal error. Three temperature-sensitive points were screened from ten temperature measurement points, which reduced the collinearity between temperature measurement points and the number of independent variables of the model. Finally, the weights and thresholds of the Elman neural network are optimized by the sparrow search algorithm, and the thermal error prediction model of motorized spindle based on SSA-Elman neural network is established and compared with Elman Neural Network and Particle Swarm optimized Elman Neural Network prediction model. The results show that the SSA-Elman neural network model has the highest prediction accuracy and exhibits good stability and generalization ability.