When is it worth rebuilding a frame? I found a discarded 'mongoose alta' frame and an 'araya - japan' front wheel. It's missing the rear wheel and the seat (no seat post either)

Looks like the gear change is still in very good shape...

All these missing parts will add up. How do I know if it’s worth fixing  this bike back up or not?
Unless the frame is unusually valuable, it is almost never "worth it" to buy new major parts, such as a new rear wheel (with cluster, et al).

A new rear wheel, once you've got the sprockets and tire on it, will cost in excess of $100, and could run $200-300 if you're determined to find "equivalent" parts.  Likewise for a bike missing a fork, a crank assembly, etc.

You can, however, get a pretty good deal using salvaged parts, either salvaging them yourself (from other scrapped bikes) or buying them from bike shops that are into this sort of thing.

I spent this afternoon helping to turn 4 broken bikes into 2 good ones, for the local school system.