Hi
I'm glad you've taken up mountain biking. I've been doing it for the better half of my life so far, and it's the best.
In regards to you losing your energy, I would suggest it's not that you're losing your energy, it's just that you need to lift your fitness level. Really, it's hard to "lose" energy, because when you slip into the aerobic energy system, all your body needs are carbs, far and oxygen to make energy, and there is no time limit on this process - that is, your body is capable of producing enough energy for exercise until you completely run out of body fat.
As you ride more and more, you will get much more fit, and will tire out much more slowly and will be able to go faster without getting tired, as your cardiovascular system will develop and get stronger.
Now before a ride, I like to eat something with a lot of complex carbs, becase complex carbs is the stuff which gives you energy for a very long time.
The best thing for complex carbs is pure oatmeal (IMO), which is generally made of pure win.
I cook it old fashioned style, in a pot, I cook heaps, and eat it without adding any sugar or anything. None of that processed crap and not the ones where you chuck it into a bowl with water, and microwave it, just pure, unprocessed oats, cooked in a pot
So that will give you plenty of energy for the ride. Now as for the ride itself, me and a friend of mine always eat a banana on a ride. Bananas are really good, because they have a good amount of energy, because they have a very good "filling" effect (that is they fill you up easily), and most importantly they stop cramps. I think bananas are essential to cardio exercise. (if you watch sports, you'll notice everyone is always eating bananas at the breaks).
I'm not sure how long your rides go for, I generally like to go for a long ride right after breakfast, so I'm nice and full.
When I get back, I have a proper meal (meat, vegetables, grains).
When going on particularly long rides, I take a pair of sandwitches made up of some kind of meat, and as many vegetables as I can cram in there. Vegetables are high in fibre which keeps you full for longer, because it can take a while to digest.
And always take plenty of water, I take 3 bottles with me usually.
And have fun, MTB is the best thing there is