That question came up briefly in my chat with Cass Sunstein, though we didn’t get much of a chance to address it. In the Star Trek world there is virtual reality, personal replicators, powerful weapons, and, it seems, a very high standard of living for most of humanity. The early portrayals of the planet Vulcan seem rather Spartan, but at least they might pass a basic needs test of sorts, plus there is always catch-up growth to hope for. The bad conditions seem largely reserved for those enslaved by the bad guys, originally the Klingons and Romulans, with those stories growing more complicated as the series proceeds.
In Star Wars, the early episodes show some very prosperous societies. Still, droids are abused, there is widespread slavery, lots of people seem to live at subsistence, and eventually much of the galaxy falls under the Jedi Reign of Terror.
Why the difference? Should we consult Acemoglu and Robinson? Or is it about economic geography? I can find think of a few factors differentiating the world of Star Wars from that of Star Trek:
1. The armed forces in Star Trek seem broadly representative of society. Compare Uhura, Chekhov, and Sulu to the Imperial Storm troopers.
2. Captains Kirk and Picard may be overly narcissistic, but they do not descend into true power madness, unlike various Sith leaders and corrupted Jedi Knights.
3. In Star Trek, any starship can lay waste to a planet, whereas in Star Wars there is a single, centralized Death Star and no way to oppose it, short of having the rebels try to blow it up. That seems to imply stronger checks and balances in the world of Star Trek. No single corrupt captain can easily take over the Federation, and so there are always opposing forces.
4. Star Trek embraces analytical egalitarianism, namely that all humans consider themselves part of the same broader species. There is no special group comparable to the Jedi or the Sith, with special powers or with special whatevers in their blood. There are various species of aliens, but they are identified as such, they are not in general going to win human elections, and furthermore humans are portrayed as a kind of galactic hegemon, a’ la the United States circa the postwar era.
5. The single individual is much more powerful in the world of Star Wars, due to Jedi and Sith powers, which seems to lower stability. In the Star Trek world, some of the biggest trouble comes from super-human Khan and his clan, but fortunately they are put down.
6. Star Trek replicators are sufficiently powerful it seems slavery is highly inefficient in that world. In Star Wars the underlying depreciation rate, as you would find it measured in a Solow model, seems to be higher. More forced labor is drafted into use to repair all of that wasting capital.
Addendum: Here is Cass on Star Wars vs. Star Trek.