In the irrigation process and fertilization process of agricultural production, the accuracy of fertilizer application and water use is kept at a relatively low level, which leads to soil slumping and waste of resources. In order to solve the above problems, this study investigates the demand for fertilizer application accuracy in the field and builds a mathematical model of variable fertilizer application system. Considering a large number of defects of the system, such as poor fertilization accuracy, long response time, and unstable regulation process, combined with MATLAB/Simulink platform, this study designs a PID algorithm based on bacterial foraging-particle swarm hybrid algorithm to control the fertilization and irrigation process of the variable fertilizer applicator. The precise fertilization control of the variable fertilizer system is mainly studied and the fuzzy proportional integral differential gain parameters of the variable fertilizer system by the hybrid algorithm are optimized. By comparing with the control algorithms (proportional-integral differential control, fuzzy proportional-integral differential control, and proportional-integral differential control with particle swarm optimization) commonly applied in the current fertilizer application system, the comparison results demonstrate that the control algorithm in this paper has better regulation, smaller overshoot, excellent stability and more rising steady-state time deficit, which can realize the precise control of the fertilizer system. Finally, this study designed fertilizer application accuracy tests under different pressure values. The results show that the algorithm proposed in this study has high fertilizer application accuracy under different pressures, which greatly reduces the waste of resources in the process of fertilizer application for crop irrigation.