Ethics is a very important topic in Star Trek. In the opening scene, the ramifications of interfering with the evolutionary course of another species is discussed.
While surveying a planet with sentient, but technologically undeveloped life, the crew discovers that an erupting volcano is about to render the species extinct. In an effort to stop the imminent eruption, Spock plants a “cold-fusion bomb” within the volcano. When it becomes apparent that rescue is impossible without revealing the USS enterprise to the indigenous species, Spock pleas with Kirk to be left behind.
Kirk saves Spock, but the species sees the USS enterprise during Spock’s rescue. Kirk is punished for disobeying the Star Fleet’s “Prime Directive”:
“No identification of self or mission. No interference with the social development of said planet. No references to space or the fact that there are other worlds or civilizations.” 
Did Kirk do the right thing?
Act Utilitarian Standpoint:
Is the net effect “good” or “bad”?
- Kirk saved an entire species (very good)
- Kirk potentially altered the evolutionary course of the indigenous species (bad)
- Kirk saved Spock from being killed by the Volcano (good)
- Kirk is punished and the Enterprise is [briefly] removed from his control (bad)
Overall, the net effect is “good”. From an Act utilitarian standpoint, Kirk did the right thing.
Rule Utilitarian Standpoint:
What if everyone started breaking the Prime Directive?
- No civilization would develop its own culture (very bad)
- Many younger civilizations would likely get taken advantage of (very bad)
- Exposure to advanced technology before the civilization is ready could have devastating effects (bad)
- Many more productive civilizations might be saved from premature extinction. (very good)
However, I think that the bad outweighs the good. By a Rule Utilitarian standpoint, Kirk made the wrong decision.
Social Contract Theory Standpoint:
The Star Fleet has clear rules that young civilizations are not to be interfered with. In the Star Trek Universe, Kirk’s actions are interpreted by many as “playing god”. Kirk knowingly disobeyed the rules of the Star Fleet, and then failed to file a proper report afterwords. By Social Contract theory, Kirk’s decision was wrong.
According to Kantian philosophy, Kirk has an obligation to save the indigenous species. Additionally, Kirk does not have any ulterior motive when trying to save the indigenous species. He is not using the indigenous people as a “means to an end”. From a Kantian standpoint, Kirk did the right thing.
There is no clear answer. Depending on the philosophy that you value most and how you weigh the pros and cons of his decision, Kirk may or may not have done the right thing.
Roddenberry, Gene, and Gene L. Coon. “Bread and Circuses.” Star Trek: The Original Series. Dir. Ralph Senensky. NBC. 15 Mar. 1968. Television.