That's like asking "If I earned $50,000 a year, when would I be a millionaire?" -- just because you're doing one thing doesn't mean it's the exclusive factor in reaching your goal.
Yes, it can help you lose weight. If you have a bad diet though, no, it's unlikely you will - depending on how bad it is. It's going to come down to your daily calorie deficit:
Calories ingested - Calories burned = Calorie balance
You want your daily "Calorie balance" to be a negative number (deficit) when you want to lose weight. You need to accumulate a deficit of 3500 calories to lose 1 lbs of fat.
So mountain biking will increase your "Calories burned", but if your "Calories ingested" remains high, it won't make you lose weight. Your best bet is to decrease "Calories ingested" (Good diet) and increase "Calories burned" (good exercise).