Get in shape. Stay in shape.
Weight training, aerobic training, good diet (nothing processed), will take you a long, long way. Especially when you drop your ride and have to pull it out of a ditch.
When I taught my son how to dirt ride, we spent a lot of time picking through the woods on tight, slow trails.
(yes, those are my real initials)