Prime Vietnam Directive [...]

The Prime Directive of Star Trek (or at least the embrace of it) may have evolved out of U.S. ambivalence about Vietnam. It was part of Rodenberry’s vision of “progressive humanity”.

The Prime Directive of “Star Trek: TOS” is primarily a way to process America’s 1960s misadventure in Vietnam. Would that more generals and chickenhawks dreamed dreams that taught them of the limits of foresight and calculation, the surprising nature of war, and the unlikelihood of success if you start by breaking things. I first recognized that “Star Trek” was a very different kind of show back in the 1960s, when at the end of “Arena” Kirk neither kills nor civilizes the Gorn, but lets him go to make his own destiny.
Gene Roddenberry mostly wanted to find a way to get people to pay him to make up stories, so that we wouldn’t have to take a job that required a lot of heavy lifting. But he also wanted to tell particular stories. The stories he wanted to tell were those that would be the dreamwork for a better future. He wanted to tell stories of a progressive humanity. He wanted to tell stories about people in a better future in which governmental institutions were smart enough to stay out of Vietnam and people weren’t obsessed with leaky roofs and food shortages. He wanted to tell stories in which racial prejudice was as silly and stupid as it, in fact, is. He wanted to tell stories in which it would be normal for a woman to be if not #1 at least #2 as first officer of a starship. He wanted to tell stories in which everyone–even the Red Shirts–was an officer, a trained and well-educated professional treated with dignity and respect by their peers and superiors. (Source)