How does the setting promote heroic play? I ask this in genuine curiosity. From an outsider perspective, it doesn't. (Or, didn't, pre 4e).
I compared to classic Ravenloft because Ravenloft is superficially similar (grim setting, evil overpowers good) but while Ravenloft doesn't provide carrots to play good-PCs (most goodly-aligned options are weakened or not available) it strongly uses sticks to encourage non-evil behavior (Evil play invokes Powers checks, which corrupt the PC to eventually become a NPC monster). So while on paper it was easy to see a Necromancer was more powerful than diviner, the necromancer was going to fast-track his own destruction just through regular use of his abilities. Hence, while Good was objectively an inferior option in the short run (less power), it was superior in the long run (your character wasn't going to become an irredeemable monster).
What is stopping Dark Sun characters (especially characters like templars or defilers) from being outright bastards? Preserving is viewed as weaker than defiling (how much weaker it actually was in the rules has been debated), paladins were anathema to the setting (both from the No Gods element and the whole idea of a noble heroic crusader not fitting). What carrot encourages heroic PCs, what stick dissuades evil ones? The best I got is "if they discover you are a defiler, you are shunned or hunted" which I feel ends up either being a nothingburger (there is little a horde of NPCs can do you a sufficient level party) or collapsing the whole campaign (Thok got us kicked out of the third City-State in a row. Why do we travel with this guy?)
I've seen some people in this thread float the idea that PCs who are intentionally gimping themselves are somehow more heroic because they choose the weaker path. Noble and all, but the game isn't exactly rewarding sacrifice, especially when Dark Sun is billed as harsh survival and life is cheap. Which again begs the question why would you pick the noble path the even the slightly-less-noble path earns you far greater odds?
I'm genuinely curious what Dark Sun does to encourage heroism or at least dissuade rat-bastardry.
For me, it promotes heroic play because it's a setting where being pragmatic and selfish is incredibly easy and boring. The entire setting is a Call to Action. Here are evil, tyrannical sorcerer kings, with cadres of evil mages destroying the world. Here are thousands of slaves being worked to death. Here is an entirely corrupt police-bureaucracy at odds with a corrupt wealth-bureaucracy who both use lesser people as pawns in their power games. Most people have so much crap raining down on them that all they can do is keep their heads down and do what they need to stay alive.
You, though, the PC -- you might be able to stand up and make a difference. What do you do?
All the examples of play, the novels, the modules, they show PCs fighting against the status quo. Again, no one is forced to do this, but it's clearly the intent of the setting, and what it's good at.
And, IMO, a heroic PC in Dark Sun is
more heroic than one in your standard fantasy game, because there are few or no communities and organisations and noble rulers that praise, encourage or reward heroism and selflessness. You're going to be fighting against the odds, hunted and hated. You might have to make some hard decisions, about allowing a lesser evil while you fight the greater one. But, long term, if you succeed, you can create meaningful change in a world where no one else dared hope for a better future.
That is Dark Sun to me, as I see it presented in the original boxed set and the Ivory Triangle, which are the two main products I treat as canon. No one can be forced to play the game heroically, but I can't see any value in using it for genuinely selfish PCs, let alone evil ones.
This is also the attitude that I see promoted in most of the Dark Sun communities. This idea that Dark Sun is some super dark setting where everyone, including the PCs, is cruel and nasty, and do cruel and nasty things, and it's everyone for themselves and the world be damned, is not something I've seen promoted or done by anyone who actually cares about the setting. It's a dark setting where there are lots of things to fight against, and the PCs are given to the tools to engage in that fight.
I'm sure there are people who embraced the cruelty and wanton violence or whatever, but those people don't need Dark Sun to do that and, as I've suggested, if you do want to do dark and edgy and mean, I don't see much value in doing it in a world where that's just the status quo anyway.