Classifying network flow subsequences in an Industrial IoT gateway is an effective method for identifying Industrial IoT faults. This paper proposes a subsequence classification algorithm SSGBUL-IKNN based on unsupervised learning encoding to address the problem of low classification accuracy. Firstly, we built a network module based on unsupervised learning to encode the flow sequence of the Industrial IoT gateway. In the encoding module, a subsequence calibration algorithm controls the increasing error during the coding process. Then, the specific fault type is obtained through an improved KNN classification algorithm based on the indication distance source from the integrated coding sequences converted by multi-dimensional network flow sequences. The test result on three Industrial IoT datasets of a sewage treatment plant shows that the accuracy of SSGBUL-IKNN in this paper exceeds 92%, significantly higher than the algorithm DTW and TSF. It reaches the classification requirements of Industrial IoT fault diagnosis.