Since it's earliest days, Star Trek has been heavily influenced by folklore and mythology. Here are some of the episodes I think best exemplify this influence, with a synopsis of the episode when available:
Star Trek: The Next Generation
Darmok - (Episode #102, production #202. Originally aired 9/30/91, available on VHS and highly recommended) - An excellent, if rather improbable episode in which we are introduced to an alien race ("Tamarians") who communicate entirely by metaphor. In order to communicate with them, Captain Picard (Patrick Stewart) equates his experience with the Tamarian captain (played by Paul Winfield) to the story of Gilgamesh and Enkidu battling the Bull of Heaven from Babylonian/Sumerian mythology.
This episode is also notable because we hear one of the Tamarians' most important myths, the story of "Darmok and Jilhad at Tanagra" (I'm not sure of the spellings there) which closely echoes the Babylonian/Sumerian myth of the first meeting between Gilgamesh and Enkidu.