Lithium battery state of health (SOH) prediction is one of the key tasks in the current battery field. Traditional model-based prediction approaches are difficult to model and have insufficient estimation accuracy. The prediction methods based on error back-propagation (BP) neural networks are easily affected by the initial weights and thresholds and fall into the local optimization problem, which affects the accuracy of the prediction results. Using the dung beetle optimization algorithm to optimize the initial weights and thresholds of BP neural networks can effectively increase the accuracy of prediction. In order to verify the feasibility of the algorithm, the data of battery B0005 in the public battery dataset of NASA of the National Aeronautics and Space Administration of the United States was used for experiments, and the root mean square error and mean absolute percentage error of SOH predicted by the method can be obtained as 0.0074292 and 0.84369%, respectively, and the experimental results show that the optimized BP neural network of the Dung Beetle Optimization Algorithm has a higher prediction accuracy.