This study aims to establish an ELISA method with high specificity for the detection of antibodies against Mycoplasma hyopneumoniae. Firstly, we constructed a recombinant strain Escherichia coli BL21(DE3)-pET-32a(+)-mhp336 to express the recombinant protein Mhp336 and used the purified Mhp336 as the coating antigen. Then, we optimized the ELISA parameters, including antigen concentration, blocking buffer, blocking time, dilution of serum, incubation time with serum, secondary antibody dilution, secondary antibody incubation time, colorimetric reaction time, and cut-off value. Afterwards, reproducibility experiments were conducted, and the cross reactivity of Mhp366 with other antisera of porcine major pathogens and the maximum dilution ratios of the sera were determined. Finally, 226 porcine serum samples were detected using the method established in this study, a commercial ELISA kit for M. hyopneumoniae antibody detection, and a convalescent serum ELISA kit for M. hyopneumoniae antibody detection. The detection results of the three methods were compared to evaluate the sensitivity and specificity of the ELISA method established in this study. For this method, the optimal antigen concentration, blocking buffer, blocking time, dilution of serum, incubation time with serum, secondary antibody dilution, secondary antibody incubation time, and colorimetric reaction time were 0.05 μg/mL, PBS containing 2.5% skim milk, 1 h, 1:500, 0.5 h, 1:10 000, 1 h, and 5 min, respectively. Validation of the ELISA method based on Mhp336 showed a cut-off value of 0.332. The coefficients of variation of both intra-batch and inter-batch kits were below 7%. The detection results of porcine serum samples indicated that the method established in this study outperformed the commercial ELISA kit and the convalescent serum ELISA kit for M. hyopneumoniae antibody detection in terms of sensitivity and specificity. We successfully established an ELISA method for detecting the antibodies against M. hyopneumoniae based on Mhp336 protein. This method demonstrated high sensitivity and specificity, serving as a tool for the prevention of mycoplasmal pneumonia of swine in pig farms.