At present, most of the environmental control systems of pigsties use direct control methods; when factors, such as temperature and humidity, exceed the set threshold value, the corresponding actuator is turned on for regulation. However, such methods have problems such as low control accuracy, high energy consumption, and untimeliness. In order to save on energy consumption and improve control accuracy, this paper takes the predicted value, set value, and current detection value of the internal environment of a pigsty as input, and combines fuzzy control and direct control methods to realize the predictive control of the pigsty environment. The test results show that, compared with the direct control method, the fuzzy predictive control method can make fluctuations in the internal temperature and humidity of the pigsty less close to the set threshold value, while the ammonia concentration hardly exceeds the set threshold value. The results show that predictive control can more accurately control the internal environment of the pigsty and reduce energy costs by about 20%. Therefore, this method can provide scientific and effective environmental control methods for agricultural production processes, such as livestock breeding and greenhouse cultivation, in semi-confined spaces.