Spectre of the Gun

When coming to an exaphobic isolationist planet, Captain Kirk and his landing party are punished for trepassing.  They are sentenced to death in a surreal recreation of the Gunfight at the OK Corral with the landing on the losing side.