As pH is a key factor affecting the quality of maize silage, its accurate detection is essential to ensuring product quality. Although traditional methods for testing the pH of maize silage feed are widely used, the procedures are often complex and time-consuming and may damage the sample. This study presents a non-destructive hyperspectral imaging (HSI) technology that provides a more efficient and cost-effective method of monitoring pH by capturing the spectral information of samples and analyzing their chemical and physical properties rapidly and without contact. We applied four spectral preprocessing methods, among which the multiplicative scatter correction (MSC) preprocessing method yielded the best results. To minimize model redundancy and enhance predictive performance, we utilized six feature extraction methods for characteristic wavelength extraction, integrating these with partial least squares (PLS), non-linear support vector machine regression (SVR), and extreme learning machine (ELM) algorithms to construct a quantitative pH value prediction model. The results showed that the model based on the bootstrapping soft shrinkage (BOSS) feature wavelength extraction method outperformed the other feature extraction methods, selecting 20 pH value-related feature wavelengths from 256 bands and building a stable BOSS–ELM model with prediction set determination coefficient (RP2), root-mean-square error of prediction (RMSEP), and relative percentage deviation (RPD) values of 0.9241, 0.4372, and 3.6565, respectively. To further optimize the model for precisely predicting pH at each pixel in hyperspectral images, we employed three algorithms: the genetic algorithm (GA), whale optimization algorithm (WOA), and bald eagle search (BES). These algorithms optimized and compared the BOSS–ELM model to obtain the best model for predicting maize silage pH: the BOSS–BES–ELM model. This model achieved a determination coefficient (RP2) of 0.9598, an RMSEP of 0.3216, and an RPD of 5.1448. We generated a visualized distribution map of pH value variation in maize silage using the BOSS–BES–ELM model. This study provides strong technical support and a reference for the rapid, non-destructive detection of maize silage pH from an image, an advancement of great significance to ensuring the quality of maize silage.