Conservative candidate Neil King described it as "Shakespearean". The contest to become the first executive mayor of Tower Hamlets – a sort of mini-Boris – fits his description in many ways. King was referring to the feud between the two frontrunners, Labour's Helal Abbas and the independent Lutfur Rahman. The latter was once the former's protege and both are councillors for the ward of Spitalfields and Banglatown, a name resonant with East End history. To this drama we may add the themes of vengeance, betrayal, religion, death threats, the influence of competing Brick Lane "curry kings" and skulduggery alleged on every side. The Bard himself would have struggled to make this up.

The saga has a local character as vivid as the borough itself, with a highly politicised Bangladeshi population at its heart. The contest's implications, though, are wider. Labour's first major test since the coalition came to power is a bigger deal than most parliamentary byelections. Tower Hamlets is symbolic as one of the five "Olympic boroughs" and its mayor will command a billion-pound budget.

The vote takes place on Thursday. Until quite recently Labour looked set to win comfortably. The party reasserted itself in May, when George Galloway and Respect were beaten in the borough's two parliamentary constituencies and all but obliterated from the council, as the anti-Iraq war mood that had split Labour ranks and much of its support faded. Abbas, a long-serving Labour man, is the current council leader. His defeat is unthinkable for his party. And yet it now appears quite possible.

If that occurs there will be claims that Labour brought disaster on itself. To the remains of the Iraq rage has been added fury over the picking of its candidate. Rahman, a solicitor specialising in family law, preceded Abbas as council leader and was replaced by Labour members after the May borough results. Now campaigning glossily as "the people's choice", he was Labour's own choice until just four weeks ago. He'd easily topped a ballot of local party members, though only after taking legal steps to fight his exclusion from the poll. He was then dropped after allegations of misconduct were made to Labour's National Executive Committee.

These included a nine-page statement submitted by none other than Abbas, who was imposed in Rahman's place despite finishing only third in the selection race. The runnerup was John Biggs, the area's London Assembly member. Biggs is white. Like Rahman, Abbas is of Bangladeshi origin. That the NEC settled on him to be the candidate is bluntly indicative of how important Bangladeshi electors are to the result. Suspicions of a stitch-up are doing Rahman no harm. He has accused the top brass of treating Tower Hamlets like "the last outpost of the British Raj". Ed Miliband's victory promise was to rebuild his party "from the bottom up". Who decides what "the bottom" is?

Tower Hamlets Labour has been in "special measures" for around 10 years due to concerns that bogus members were influencing its affairs. Abbas's statement to the NEC provides accusations along these lines, but little proof. Its torrentially leaked charge sheet, strongly refuted, closely resembles that compiled in a sweatily reductionist TV documentary shown earlier this year. It includes vote rigging, intimidation and the claim that Rahman has been "brainwashed" by a Whitechapel-based Islamic community organisation as part of an entryist plot.

Conspiracy addicts including the English Defence League have seized upon such claims, massing in the blogosphere like poisonous flies and fostering the ludicrously false impression that a part of London where Irish and Jewish East Enders repelled Oswald Mosley's fascists in 1936 is now a "third-world" hotbed of scheming fundamentalists where no white citizen dares tread. Rahman's campaign accuses its opponent of pandering to the same narrative to justify the crushing of grassroots autonomy and of being an establishment puppet.

Labour's campaign cry is for an East End unity transcending religion and ethnicity in defence of public services. It accuses Rahman of being a divisive Respect candidate in disguise: the latter party is backing him while standing no candidate of its own. Yet just below the surface lie the trickier issues of angry young Muslim Britons drawn to militant lslamic views, the political disconnection of non-Bangladeshi residents and the right relationship between faith activism and secular politics in a place where these have long been entwined

The result will depend heavily on turnout – the higher it is, the better Labour's chances. Win or lose, Miliband's party will have some big thinking to do. Tower Hamlets may be distinctive but it highlights challenges Labour also faces in very different parts of Britain. Miliband wants to build a campaigning party rooted in communities. What shared values will mobilise them? How does it re-engage those it's lost?