SAN FRANCISCO — Over the last decade, this has become the tech industry’s hometown.

But as voters go to the polls Tuesday to choose a mayor in one of San Francisco’s most disputed elections in recent memory, the industry that set off a high-rise construction boom and has been blamed for a housing crisis in the city is fading into the background.

That is quite a contrast to the last open mayoral election, in 2011. Tech leaders were featured in a video for their preferred candidate, Ed Lee, who went on to win and was re-elected in 2015. It has been viewed more than 600,000 times on YouTube. This year, several candidates are vying to replace Mr. Lee, who died in December, but none of them has tried to enlist tech in anything so striking.

What is happening — or rather not happening — in San Francisco is part of a broader urge in the tech community to stay behind the scenes in state and national politics. The overwhelmingly Democratic-leaning Silicon Valley was shocked by the 2016 election of Donald J. Trump and aghast at his anti-immigration ban, which cut to the heart of their existence as a multinational industry whose companies have often been founded by immigrants.