Star Trek: The Original Series, season 3, episode 6
Spectre of the Gun
Summary
For trespassing on an alien world, Captain Kirk and his companions are forced to re-enact the famous shoot-out at the O.K. Corral with themselves cast as the losing side.
Summary from Wikipedia, CC BY-SA 4.0.
Find out more
These links open the services in a new tab with the question pre-filled; the AI assistants may ask you to sign in. Their answers can contain errors.