If it has been ridden long enough with a loose headset that the cups are loose in the frame, it's dead. Otherwise, go for it. I'd start with the headset just to make sure it is ok before tackling anything else.
On the other hand, if you are looking to specifically use it as a mountain bike, then you will likely get a better result with a more modern hardtail.