With the widespread application of infrared thermal imagers in various fields, the demand for thermal imagers and their performance parameter testing equipment has increased significantly. There are particularly high demands on the detection accuracy of minimum resolvable temperature difference (MRTD) testers. Traditional MRTD testers have an issue with the four-bar target temperatures being easily affected by the external environment, resulting in non-uniform temperatures and imprecise detection results. This paper proposes an improvement to the four-bar targets by making them temperature-controllable. Temperature is controlled by installing thermoelectric coolers (TECs) and thin-film platinum resistors at the center and periphery of the four-bar targets with different spatial frequencies. The dung beetle algorithm is used to optimize fuzzy PID parameters to regulate the TEC’s heating and cooling, improving the overall temperature uniformity of the four-bar targets. Temperature simulations of the four-bar targets were conducted on the COMSOL platform, with the control part simulated on the Simulink platform. The simulation results show that, compared to traditional PID, the fuzzy PID controller reduces overshoot by approximately 3.6%, although the system still exhibits mild oscillations. The fuzzy PID controller optimized by the dung beetle optimization (DBO) algorithm, in comparison to standard fuzzy PID, reduces the settling time by about 40 s and lowers overshoot by around 7%, with oscillations in the system nearly disappearing. Comparing the fuzzy PID optimized by the particle swarm optimization (PSO) algorithm with the fuzzy PID optimized by the DBO algorithm, the DBO-based controller shows shorter rise and settling times, further illustrating the superiority of the fuzzy PID control optimized by the dung beetle algorithm. This provides a theoretical foundation for improving the accuracy of MRTD detector measurements. Finally, experimental verification was carried out. The experimental results indicate that DBO (drosophila-based optimization) has significant advantages, and its optimized results are closer to the actual values.