Generating economic value from work that the OP describes would not be "air conditioning" it would be converting heat into work -- which cannot be over 100% efficient, and in fact would be significantly less than 100% efficient at the temperatures we know.
Removing that heat using a heat pump would require some off-world reservoir of cold, which doesn't exist. The reservoir of cold that we are using now (and in any conceivable future) is the earth itself, which is what the parent comment means by "you can't use the work."
Space has an average temperature of 2.7K, and there's a lot of it. Can interplanetary space be an off-world reservoir of cold?
It's possible to make radiative coolers that do exactly this, within limits. It's easy at night; harder in the daytime. Here's an example.
(This is also why cloudy nights are warmer than clear nights in winter--clouds prevent some of the ground's heat from radiating away.)
The technique has been used for centuries to make ice in the desert, but it only works at night and it's inefficient.
https://www.fieldstudyoftheworld.com/persian-ice-house-how-m...
With modern technology it's more efficient and it appears it can even be made to work in the daytime:
https://energyindemand.com/2020/10/17/generations-after-peop...
An air conditioner performs the work of moving heat from one place into another. There's a reason your compressor is outside, that's because if it were inside the heat pump wouldn't work. You're expending energy to move heat generating more heat, you'd just heat up your house. The compressor wouldn't work outside if the heat wasn't convected or conducted off the radiator into the air, there has to be a temperature differential between the ambient environment and the radiator.
With the earth, there's nowhere to pump the heat to, there's only vacuum. You'd have to convert the heat to something else like light, radiate it out, expend energy to do it, and in the process generate more waste what from that energy that will then radiate out at the natural pace. At best in this process, you'd break even and just be really expending energy beaming light out into space and accomplish nothing with regard to the heat you're trying to move.
Keep in mind that air conditioners are net generators of heat. The work they do moving heat around generates more heat. If you build a sealed sphere 100 feet in diameter around an air conditioner and plug it in, the air inside the sphere will heat up. This is why you cannot just open your refrigerator door to cool your house. Earth's atmosphere is warmer today around cities where a lot of air conditioners are in use. (Although excess CO2 has a much bigger effect of course.)
Surely this can't be right, because if it were, air conditioning (the normal everyday kind) would be impossible, right?
What we're talking about here is loosely analogous to air conditioning the entire Earth (with the heat being sent to space rather than the outside air). Sounds like a hard engineering problem, but not impossible.