This paper describes a software algorithm for detecting defective insulating structures using infrared images. The defect detection criteria are based on a joint analysis of the mean and standard value of the brightness distribution of a set of insulators. The effectiveness of the developed criteria is substantiated by the results of laboratory tests of a significant number of insulators removed from high-voltage lines according to the results of thermal imaging diagnostics. Simultaneous analysis of thermograms of the same type of insulating structures according to the proposed algorithm is more effective in comparison with the subjective assessment of each of them separately, which was used earlier. In addition, this approach allows to reduce the time of analysis and decision-making based on the results of diagnostics.