In view of the current problems of complex models and insufficient data processing in ultra-short-term prediction of photovoltaic power generation, this paper proposes a photovoltaic power ultra-short-term prediction model named HPO-KNN-SRU, based on a Simple Recurrent Unit (SRU), K-Nearest Neighbors (KNN), and Hunter–Prey Optimization (HPO). Firstly, the sliding time window is determined by using the autocorrelation function (ACF), partial correlation function (PACF), and model training. The Pearson correlation coefficient method is used to filter the principal meteorological factors that affect photovoltaic power. Then, the K-Nearest Neighbors (KNN) algorithm is utilized for effective outlier detection and processing to ensure the quality of input data for the prediction model, and the Hunter–Prey Optimization (HPO) algorithm is applied to optimize the parameters of the KNN algorithm. Finally, the efficient Simple Recurrent Unit (SRU) model is used for training and prediction, with the Hunter–Prey Optimization (HPO) algorithm applied to optimize the parameters of the SRU model. Simulation experiments and extensive ablation studies using photovoltaic data from the Desert Knowledge Australia Solar Centre (DKASC) in Alice Springs, Australia, validate the effectiveness of the integrated model, the KNN outlier handling, and the HPO algorithm. Compared to the Support Vector Regression (SVR), Long Short-Term Memory (LSTM), Temporal Convolutional Network (TCN), and Simple Recurrent Unit (SRU) models, this model exhibits an average reduction of 19.63% in Mean Square Error (RMSE), 27.54% in Mean Absolute Error (MAE), and an average increase of 1.96% in coefficient of determination (R2) values.