Traditional security abnormal behavior detection algorithms are difficult to adapt to the Industrial Internet of Things scenario. To this end, an algorithm for detecting abnormal behaviors of the Industrial Internet of Things based on random inspections is proposed. Based on the clustered hierarchical Industrial Internet of Things topology, it manages the number of network nodes and sets different inspection inspection rates according to the reputation value interval. Detect and analyze the communication behavior attributes of nodes in the network such as packet loss rate and transmission delay, perform reputation evaluation, and then discover abnormal behaviors of the nodes and detect different types of malicious attacks. Simulation results show that the new abnormal behavior detection algorithm improves the detection accuracy without affecting the life of the network. The proposed random inspection mechanism helps the algorithm to find malicious nodes with low energy consumption and high efficiency, and improves the security of the Industrial Internet of Things.