Munich mayor Dieter Reiter had said he wanted to light up the stadium in the colours in protest against a new law in Hungary that bans the dissemination of content in schools deemed to promote homosexuality and gender change.
The Allianz Arena, home to Bayern Munich, is configured to allow the entire external area and roofing to be lit up in various colours.
In a statement, UEFA suggested alternative dates for the gesture during the tournament.
"UEFA, through its statutes, is a politically and religiously neutral organisation. Given the political context of this specific request -- a message aiming at a decision taken by the Hungarian national parliament -- UEFA must decline this request," the organisation said in a statement on Tuesday.
"UEFA has nevertheless proposed to the city of Munich to illuminate the stadium with the rainbow colours on either June 28 -- the Christopher Street Liberation Day -- or between July 3 and 9 which is the Christopher Street Day week in Munich."
Christopher Street Day events are held to commemorate the gay community's Stonewall uprising in New York in 1969.
German Europe Minister Michael Roth told reporters ahead of a meeting with his EU counterparts in Luxembourg on Tuesday that Hungary's new law clearly violates European Union values.
The Hungarian foreign minister Peter Szijjarto had said on Monday that "mixing politics and sport" was "harmful and dangerous" and he welcomed the UEFA decision.
"Thank God that in the circles of European football leadership, common sense still prevails and they did not play along with the political provocation," he said.
"I think, no, I can say that the leadership of UEFA made the right decision when they decided not to play along with the political provocation against Hungary."
UEFA said it was involved in a number of campaigns around diversity and inclusion "to promote the ethos that football should be open to everyone."
The decision comes two days after UEFA said Germany captain Manuel Neuer and the German Football Association (DFB) would not face any disciplinary action for wearing a rainbow armband during the tournament.
Neuer, 35, wore the armband against France and Portugal, to show the DFB's support for the LGBTQ+ community during Pride Month.
UEFA were investigating whether this contravened their rules over athletes not being permitted to make political statements. But UEFA said Sunday in a statement Neuer was "promoting a good cause" and opted against pursuing any further action.
Hungary are still under investigation by the governing body over "potential discriminatory incidents" during their games against Portugal and France at Budapest's Puskas Arena.
During Hungary's opening match against Portugal on Tuesday, images on social media showed banners with "Anti-LMBTQ" on them -- the Hungarian abbreviation for lesbian, gay, bisexual, transgender and queer.