This comes up on the rare occasion that we must sing English. Grammar Girl explains when to say (or, for us, sing) "the" as "thuh" and as "thee." Here's the condensed version (emphasis as in the original):
Oh, the image? "The The" is a British band that was popular in the 1980s and early 1990s.Pronounce it “thee” if the next word starts with a vowel sound.Pronounce it “thuh” if the next word starts with a consonant sound.Just like with a versus an, it’s not the first letter of the next word that matters, it’s the first sound.