carter,
I sure hope it's the Belt, and of course if it's twisted, then replace it.
But, if it looks pretty good, you need to take a Streight Edge, that can be a tubular piece of metal, a piece of wood, or anything that's two to three feet long, thin and straight.
Place it across the flat/front of the Motor Pully, and across to the drum. Holding it flatly and firmly against the Pully. Then look at the other end of the Straight Edge, at the point the Belt rolls over the Drum and see if the Belt is within 1/4" of the Straight Edge.
If not, you'll need to reposition the Motor to get those two points to align.
Take a look at this...
Clothes Dryer Belt Route & Alignment
The Belt Tension is the other csuse of one rolling off the Pully, make sure that there is a good pull on it with the spring loaded Idler.
Have a good Day !
S.W.