Natural gas leakage accidents frequently occur during pipeline transportation, and accurately identifying the type of leakage failure is a technical difficulty. This paper proposes a fault diagnosis method for natural gas pipeline leakage based on 1D-CNN and the self-attention mechanism. Firstly, taking the leakage signal of GPLA-12 natural gas pipeline as the research object, 12 types of faults were determined; secondly, the basic model of fault feature with self-learning is built by using the wide convolution 1D-CNN; then, the self-attention mechanism is introduced after the pooling layer of the above model to strengthen important fault information and suppress irrelevant components in fault features; finally, a natural gas pipeline fault diagnosis model combining 1D-CNN and the self-attention mechanism is established. The experimental results show that the method proposed in this paper improves the recognition accuracy by 21% and 12%, respectively, compared with the DRSN_CS and DRSN_CW methods.