It is a race to take charge of the world’s largest city – a metropolis with a population more than half the size of the United Kingdom and with a GDP greater than all but 10 countries.

But the election for the post of governor of Tokyo has piqued interest not only because of the size of the task which falls to its victor, but also for the mud slinging and misogyny which has characterised the fight between the candidates.

Voters in Tokyo will go to the polls on Sunday amid a campaign marred by events that some say highlights the worst of Japan’s male-dominated politics.

The winner will take over after the two previous incumbents resigned in disgrace, and is tasked with overseeing the 2020 Olympics, coming up with ways to offset problems caused by the capital’s rapidly ageing population, and providing better child care services.

It is a weighty job serving approximately 37 million people in the Tokyo metro area and a record 21 candidates are running.

The race has boiled down to three major candidates, including Yuriko Koike, a graduate of Cairo University, and former government minister. If elected Koike would be the first female governor of Tokyo, and only the seventh woman to run one of Japan’s 47 prefectural areas.

Koike broke ranks with the Liberal Democratic party to run as an independent, against the establishment candidate Hiroya Masuda, a one-time cabinet minister.

And she has since faced sexist attacks. Earlier this week a former Tokyo governor, Shintaro Ishihara, referred to the 64-year-old Koike and her make up in terms that translate as “a caked-up old woman well past her prime”.

Women remain under-represented in the halls of power, occupying only 45 of the 475 seats in the lower house of parliament.

The sexist nature of Japanese society also appears to condone a gender prejudice that would not be tolerated in other advanced nations.

In June 2014, Ayaka Shiomura, an elected member of the Tokyo metropolitan government made a speech in support of working mothers but was heckled by male members with jibes including “you…should get married!”.

The remark was followed by peels of male laughter. It took five days and pressure from the assembly before the identity of the perpetrator was revealed.

Among the public there is support for Koike, with some seeing a glass ceiling waiting to be smashed.

Kumiko Watanabe, a Tokyo woman, supports Koike. “Japanese male politicians are too proud to accept a female candidate. Their overall level as human beings is pretty low,” she says.

“South Korea has a female president, the UK has a female prime minister, and it looks as though Hillary [Clinton] will be elected in the US. Isn’t it about time we had a female governor of Tokyo?”

Meanwhile one of Koike’s rivals, Shuntaro Torigoe, a respected journalist running as a left wing candidate, has seen his campaign plagued by a sex scandal more than 10 years old, where he is alleged to have seduced a 20-year old university student. The married Torigoe was more than twice the student’s age at the time of the supposed incident.

<!–[if IE 9]><![endif]–><!–[if IE 9]><![endif]–>Shuntaro Torigoe’s bid to become Tokyo governor has been plagued by allegations of sexual misconduct.

Shuntaro Torigoe’s bid to become Tokyo governor has been plagued by allegations of sexual misconduct. Photograph: Shizuo Kambayashi/AP

The latest edition of the weekly magazine, Shukan Shincho, repeated the allegations, and quoted the alleged victim,and her boyfriend of the time, saying she was blinded by Torigoe’s celebrity, as a TV-based commentator. She later married the boyfriend.

Torigoe has called the allegations groundless, issued a letter of protest, and has said he will sue the publication.

Some see a deliberate smear campaign under way.

“The art of political assassination has been honed well by this political establishment, and they rarely fail,” says Jeff Kingston, director of Asian studies at the Japan campus of Philadelphia’s Temple University. “But, the timing just before the polls is suspicious because the last thing the establishment wants is a progressive reformer like Torigoe.”

Even if the allegations prove false, some of the mud is likely to stick, he adds.

Independent voters may help swing the election on Sunday when many are likely to absent themselves from the capital in favour of the beach or the mountains. Koike needs such voters to help break down the establishment vote machine and may have done enough to swing the vote in her favour.

“The election is basically a popularity or name recognition contest, and with Torigoe hobbled by unproven allegations [Koike] is sitting pretty,” Kingston says.