SALT LAKE CITY — It was only at the end of the debate — after arguments over city rail service, policing and homelessness — that Jackie Biskupski nodded to how her mayoral run could make history here in Utah’s capital.

“When I was elected to the Utah Legislature, that was no cakewalk,” she said. “I was the first openly gay elected official, and there was a lot of hard work that needed to be done then, and there’s a lot of hard work that needs to be done in our city today.”

Ms. Biskupski, who is in a close race against Salt Lake City’s two-term incumbent, will become the city’s first openly gay mayor if she wins the election on Tuesday. She and Mayor Ralph Becker, both Democrats, are running on a nonpartisan ballot.

It often surprises visitors to learn that Salt Lake City, the headquarters of the Mormon Church, where returning missionaries receive cheers at the airport, is also home to a rollicking gay pride parade, a gay-friendly men’s choir and a boutique hotel offering guests a “gay power package.” People sometimes describe the city as a rainbow island surrounded by a very red state.