To address the issue of high self-corrosion rate of Mg anodes in seawater batteries leading to low discharge efficiency, the green inhibitor, sodium dodecyl sulfate (SDS), was utilized to enhance the discharging performance of AZ31B alloy. The addition of SDS in a 3.5% NaCl solution led to a reduction in the corrosion rate of AZ31B alloy due to the formation of S-containing compounds. During the continuous-discharging period, the addition of 0.05 M SDS increased the anodic utilization efficiency from 64% to 81% and the specific energy density of the entire battery elevated from 1280 to 1912 mAh g−1 (an increase of 49%). The enhancement of the discharge performance of AZ31B Mg alloy in a 3.5% NaCl solution by SDS can be attributed to three aspects: reducing the negative difference effect of the Mg alloy, decreasing the accumulation of corrosion products on the surface of the Mg alloy, and promoting a more uniform dissolution of the Mg alloy.