If space has to be the only solution (and as others have pointed out its very tough to get to work), then there is one obvious "best" location.
First, lets consider your resources. It's difficult to predict what launch technologies will look like in the next 50 years. But we do know that reusablity is going to dramatically reduce costs, because it already has.
SPACE WAS EXTREMELY EXPENSIVE.
Getting to space has been historically extremely costly. A Shuttle flight cost around $2B in current dollars, and was so costly for two main reasons. One it was a government project built by cost plus contractors where components had to be built in all 50 states (massive solid rockets trucked from Utah to Florida?). More importantly it wasn't really reusable, it required hugely expensive maintenance. The Shuttle engines had to be entirely rebuilt every launch, the solid rocket boosters were destroyed on landing and only parts could be used, and a hugely expensive Hydrogen fuel tank was burned up every flight. Plus the rest of it required expensive maintenance between flights, the Orbiters critical heat tiles had to be carefully inspected and replaced.
The Shuttle was the most expensive launch vehicle ever in cost per pound, around \$40,000 per lb for the payload (ignoring the Orbiter). Thats is the main reason why the ISS cost over \$150B to build. But now a Falcon 9 reusing the first stage can put about 2/3s as much payload in space for \$50M (about \$1,500/lb), and that's at a profit.
REUSABLE ROCKETS WILL MAKE SPACE FLIGHT A LOT MORE LIKE COMMERCIAL AIR TRAVEL
Over the next 60 years it's clear that fully reusable space vehicles will dominate space launch. Fully reusable means a rocket that can launch payload to orbit and all of the rockets components will return to earth where they are quickly and inexpensively inspected and refueled to fly again. SpaceX is building a design right now, the Starship, and even if Starship fails more designs are going to be attempted (RocketLabs Neutron is another) until one succeeds. The benefits are simply too massive to ignore. If Starship meets its initial design goals it will cost less than \$30M for 150,000 lbs to orbit, or about \$200/lb.
But how much cheaper can a reusable rocket system get? Essentially when rockets can be reused hundreds of times they will have similar economics to commercial jetliners, where the most expensive cost becomes fuel instead of expending key components every flight (note that similar economics doesn't mean as cheap as). Starship is a Super Heavy launch vehicle, it will be the largest ever made, and its fuel costs are estimated at about \$1M per launch. Musks goal is to launch each Starship one hundred times to spread the costs of construction over many launches. If he achieves that the cost per flight can be as little as \$5M, or \$33 per pound to space.
https://space.stackexchange.com/questions/58161/what-is-the-lowest-the-cost-of-launch-can-get-to/58222#58222
You might also look into nuclear rockets like the NERVA project successfully test fired in the 1960s, but as I'll explain they aren't likely to offer better economics than a high cadence reusable chemical rocket like Starship for your obvious destinations.
So great, we can lift large payloads and lots of people into space very cheaply now, where do we send them?
THE MOON IS UNINHABITABLE
Not the moon. It's an inhospitable desert lacking in resources. Water is only available on the poles and the rest of the moon is over 250 degrees for two weeks at a time, and near absolute zero with no solar power the next two weeks. There are lots of elements in the regolith you could try to melt out, but that's an immense amount of energy. And the regolith is razor sharp, so you must keep it out of crew quarters to avoid breathing it in. The reason the regolith is razor sharp is its never been weathered, it has no atmosphere which means every payload has to use a huge amount of fuel in order to land on the moon.
MARS IS BETTER, BUT STILL NOT THE ANSWER
Mars is better. It's much farther than the Moon, about a 3-9 month trip depending upon when you leave and the amount of fuel you spend. But it's atmosphere makes a huge difference. It actually takes less energy to go to the surface of Mars than the Moon because you can aerobrake into its atmosphere without using hardly any fuel. Its temperature range is less than half the moons because of that atmosphere. And it's awash with resources, CO2 for producing fuel and oxygen, ice water for many uses, nickel iron meteorites littering the surface. And the atmosphere has weathered the dust so it's not going to rip apart your lungs or space suit (though it does have slightly poisonous perchlorates that need to be washed off when anyone comes inside).
But Mars isn't the answer either. First, going to Mars or the moon means you increase your fuel requirements as much as ten times from just going to space. The SpaceX plan for exploring Mars with Starships requires as many as ten or more tanker flights to refuel the Starship for the journey. Now your \$30 per pound cost just ballooned back to \$300+. Nuclear Rockets can't help you here, because of their required shape and shielding they can't use aerobraking effectively, so their power advantages are lost to Mars.
And you'd have to send millions of tons of supplies, tools, and equipment to ensure the colonists had everything they needed to last as long as it takes for Earth to return to habitability. They'd have to be self sufficient. How do you make that happen? Maybe they could survive on nuclear power and hydroponic crops grown in underground shelters to avoid the higher surface radiation. But how would they repair things? How would they even make plastics? How would they get all the elements and organic molecules we take for granted on earth?
SPACE OFFERS ONLY ONE CHOICE
No you really only have one choice if humanity is forced off planet. Earth orbit. Its by far the cheapest and easiest place to send people. You can put at least ten times as many people in low earth orbit than on Mars or the Moon with the same number of launches. Its protected by the Van Allen belts giving much lower radiation than open space. Its super close meaning your cargo rockets can turn around quickly to fly even multiple times a day, far more often than if they were stuck on week long lunar trips or years long Martian trips. And if the conditions on earth ever improve briefly, say during specific orbital aligments, you'll be able to pop down to collect raw materials.
At \$30 per lb you could launch the million pounds of materials to make another ISS for only \$30M. In reality the ISS is far too small to survive for decades on its own, you'd need to build structures a hundred times larger where a thousand times more people could live. They'd have to be redundant so that any leaks or damage could be isolated and repaired without the entire structure losing atmosphere. And they'd have to be spinning, because humans can't survive in zero gee for years on end without extremely damaging health issues. Essentially you need to build O'Neil Cylinders, large spinning cylinders where people live on the insides. Probably the smallest ONC that could provide for long term survival is at least a billion pounds (ten times the size of a Supercarrier).
And they'd need a ton of redundant power systems. You can't just rely on solar no matter how strong it is, if your panels fade over time you need to be able to replace them or augment them with other power sources (like nuclear).
Devoting 10% of the US Economy to this task for 50 years would give you about \$100 Trillion to invest in it. Using half the funding for payload launch at \$30 per pound, would put 1.5 trillion pounds of space station components (and supplies, tools, equipment, backup supplies/tools/equipment, etc) into orbit. The rest of the money would pay for building the components on earth, flying crews into space to assemble them and finally their inhabitants up to spend their lives in them.
If you assume you need at least 20,000 lbs of structure, hydroponics, materials, tools, equipment, and their backups per person, each billion pound O'Neill cylinder would host 50,000 people, and you could have up to 1,500 of them supporting a total population of 75 million people.
NEAR EARTH ASTERIODS AS RESOURCES
You'd also want to investigate near earth asteroids that are within a few months of earth where you can get cheap access to millions of tons of raw resources without having to lift it from the earths surface. They contain water, carbon and metals like iron, gold and platinum. If possible you may want to divert some to orbit next to your habitats so they can be mined easily to augment supplies.
RISKS
Lastly you'd still have massive risks. Two new moons would throw the orbits of many near earth objects into widely unpredictable orbits. Massive meteor showers could destroy many of your habitats. Their own orbits won't be stable, they'd have to at least be at the higher parts of the low earth orbits where they won't be in danger of reentering the earths atmosphere for thousands of years. Even then they'll need fuel for orbital adjustments or end up being helpless to avoid any collisions, even with each other.