Use a dummy melody.

An easy way to stick to a certain meter is to use a dummy melody as a basis for your writing. There is one poet the author knows who tends to use about four base melodies
in his writing. Most of his serious work is written with the tune to Leader of the Band in mind. It keeps his meter consistent; the rhyme scheme is worked out for him; its the lazy poets
way of keeping on track.

This technique does not have to be limited to poems intended as songs. It also makes sticking with a rhythm, rhyme, and meter easier in a non-lyrical poem.