If we really wanted to, there's no reason we couldn't do both and they're is a blocking issue for the other and some of the technology and science for both are complementary (planetary science, solar and battery technology, environmental control, automation).
Personally.
One needs beauty in the world, yes, but one also needs to breathe.
If humanity dies or goes pre-industrial because someone engineered a supervirus and we refused to put effort into space travel, all our conservation efforts won't really matter much.
Anyway, what's the point of focusing all efforts on Earth if human civilization is going to die out here anyway? That's the path we're currently on, and stopping space exploration isn't going to magically fix that. Wanting other baskets for the egg of human civilization is just pragmatism.
Dunno if you've heard, but this Universe is condemned. In about a hundred trillion years it'll run out of hydrogen and burn out. Might as well enjoy it while we can.
Given that, it absolutely makes sense to colonize space, as Mars can't be ruined in the same way that we're ruining Earth, and the petroleum mining industry won't be coming along for the ride.
For example:
https://en.wikipedia.org/wiki/Timeline_of_solar_cells
Space isn't solely responsible for solar cells, but I can't help but note these entries in the timeline.
1950s - Bell Labs produce solar cells for space activities.
1954 - On April 25, 1954, Bell Labs announces the invention of the first practical silicon solar cell
1958 - T. Mandelkorn, U.S. Signal Corps Laboratories, creates n-on-p silicon solar cells, which are more resistant to radiation damage and are better suited for space. Hoffman Electronics creates 9% efficient solar cells. Vanguard I, the first solar powered satellite, was launched with a 0.1W, 100 cm² solar panel.
Would the solar cell technology we enjoy today have developed as quickly or at all with that little extra push of space investment to move it along? Would the research ever have ended up as practical without hard engineering problems to solve along the way?
I think you'll find similar connections for fuel cells, and battery tech. You see metals research now which is applicable for the space application first, but the engineering knowledge will likely get re-applied in more expanded mundane applications in due time...