With the rapid development of intelligent manufacturing and Industrial Internet of Things, many industrial control systems have high requirements for the security of the system itself. Failures of industrial control equipment will cause abnormal operation of industrial control equipment and waste of resources. It is very meaningful to detect and identify potential equipment abnormalities and failures in time and implement effective fault tolerance strategies. In the Industrial Internet of Things environment, the instructions and parameters of industrial control equipment often change due to changes in actual requirements. However, it is impractical to customize the learning method for each parameter value. Aiming at the problem, this paper proposes a fault diagnosis model based on ensemble learning and proposes a method of updating voting weights based on dynamic programming to assist decision-making. This method is based on Bagging strategy and combined with dynamic programming voting weight adjustment method to complete fault type prediction. Finally, this paper uses different loads as dynamic conditions; the diagnostic capability of the Bagging-based fault diagnosis integrated model in a dynamically changing industrial control system environment is verified by experiments. The fault diagnosis model of industrial control equipment based on ensemble learning effectively improves the adaptive ability of the model and makes the fault diagnosis framework truly intelligent. The voting weight adjustment method based on dynamic programming further improves the reliability of voting.