That happens when the rear wheel moves as you torque the axle nut. Here's what I learned on dirt bikes: loosen the axle nut, then set the chain tension. You need to pull down pretty tight on the chain when you do this. Leave the axle nut loose.
Now use a small screwdriver or etc (a pocket screwdriver is perfect), stick it sideways across one of the sprocket teeth and roll the bike till the screwdriver is clamped between the chain and sprocket. Check the adjuster marks to be sure they are the same on both sides, then torque the axle nut. Roll the bike to release the screwdriver, recheck the chain adjustment, if it's right (and it should be) then snug the locknuts down. This has saved me a LOT of aggravation over the years.