TOS was labeled "optimistic" only because it did show a future where somehow humankind got through it all (kids, let me tell you about the 1960s), solved a few major problems, and seemed to be able to get along well enough to cooperate for a greater good.
It presented a better world, but never a utopia.
Exactly. And the people who lived there were still flesh-and-blood human beings with all the strengths and frailities and irrational emotions that entails. Not enlightened role models who have evolved beyond primitive human imperfections.
Don't get me wrong. The fact that TREK takes place in a future that largely works,
as opposed to some post-apocalyptic wasteland or soul-crushing dystopia, is one of the main things that distinguishes it from a lot of media SF: Planet of the Apes, The Invaders, Logan's Run, Terminator, Road Warrior
, etc. That's a big part of its appeal.
But, remember, we never actually saw
any sort of "utopian" Earth back on TOS. What we actually saw
--what the show was really about--was wild and woolly and occasionally thought-provoking adventures out on the rugged final frontier, light-years away from whatever advanced society produced Kirk and McCoy and Sulu and the rest . . . . Earth's progress was mostly just implied, and was never the whole point of the show.
(I admit to being biased here. As an editor, I have seen even good writers go astray when they start putting their "message" ahead of the story. Don't get me started on that romance novel I edited years ago in which the boy and girl kept lecturing each other on the importance of saving the environment--even during the love scenes! Clearly, it traumatized me for life--and made me very leery of folks who think that a "message" or "vision" takes precedence over telling a good story with memorable characters.)