I've read different ranges that people have got with the Varg and I think that a lot depends on the route, especially how twisty it is, the type of dirt and whether there are higher speed sections, so I think that there is not enough information to answer.
I don't have a degree in anyhing but I like physics and matemathics:
If you ride at 40 mph for 40 miles, it means that you ride for 1 hour. The useable energy of the battery is a little less than 6 kwh (I wouldn't ride when the SOC is below 10%, I think you would really risk damaging the battery), so it means that in that hour you have an average available power of a little less than 6 kw. Now honestly I have some books/documents somewhere where I can read an estimate of the coefficient of drag of a dirtbike, to be used to estimate the power required to sustain 40 mph, but considering some figures that I remember for street bikes and adjusting for that much worse coefficient, I think that a decent estimate would be that you need 2 or 3 kw for the air drag at constant 40 mph. The air drag would be the main energy consumer if riding at constant speed on asphalt, but I don't know when riding with knobby tyres in the dirt. The friction of the tyres surely is not negligible; the one of the transmission I think it is. In reality I also doubt that you will ride at constatn speed and the only information we have is distance, elevation change and average speed, but the energy used for accelerations exiting corners, which gets lost when you slow down before entering the next corner surely is non negligible either.
Bottom line: I doubt that you can predict for sure whether you'll make it.