A CLUSTER of surprisingly pink boxes by a busy road in Dunfermline, Pitcorthie Primary is stuccoed in bureaucratic safety signs.

Speed Action Area, No Stopping, No Dogs Allowed, and the timeless No Unauthorised Ball Games.

But a different kind of sign has appeared lately on the railings, one suggesting a larger threat is lurking. "Save Pitcorthie Primary," this banner says. "Our school, our community!"

Pitcorthie's pupils, like those at nearby Wellwood and Crombie, face the loss of their school in an unpopular closure programme. Amid falling school rolls, Labour-run Fife Council is holding a consultation on the idea to save money.

It is a familiar story around Scotland. But in Dunfermline, thanks to the Holyrood by-election caused by the resignation of convicted wifebeater Bill Walker, the fate of the three schools has become inextricably linked with that of Alex Salmond and Johann Lamont.

The SNP believes the closures will let the party cling on to a seat won by just 590 votes in 2011. The party's candidate, Shirley-Anne Somerville, is being portrayed as the heroic defender of the plucky primaries, on the side of parents everywhere.

Labour candidate Cara Hilton, who endorsed the closure consultation as a member of Fife Council, is said to have broken faith with her community. Well, that's the SNP theory, at least.

"I'm not sure it will make a difference who wins," said Christina Taylor, 28, as she arrived to pick up her two daughters from P6 on Friday. "Politicians are all the same. They're all full of what they're going to do, and then when they get in they do absolutely nothing."

Holyrood by-elections are rare - this is just the eighth since 1999 - so there is always a danger of reading too much into any one result. But Dunfermline matters.

If Labour wins, it will be the first time a seat has changed control in a by-election since the Conservatives took Ayr from Labour 13 years ago. If that happens, the cry will go up from Lamont and her party that Scotland has finally fallen out of love with the First Minister, and the Yes Scotland independence campaign hasn't a cat in hell's chance of success.

However, if the SNP can pull off a mid-term win after six years in power, against the awful backdrop of the Bill Walker case - he was a former member of the party - it will be Salmond who reads Lamont's leadership the last rites, and declares game on for September 18 next year.

"It would be a good opportunity for us to show momentum towards the referendum in 2014," says Somerville of an SNP win.

Right now, however, the SNP is on the back foot.

Professor John Curtice of Strathclyde University said it would be "staggering" if Labour didn't win, given the SNP's mid-term slide in support. Though the party won the Aberdeen Donside by-election in June, the Nationalists lost almost 5000 votes, or 13.2 percentage points in the process.

"The shock would be if the Labour Party didn't win Dunfermline. That would be news," Curtice said.

Asked if he was predicting a win, Salmond was less ebullient than usual. He said carefully: "I believe we can win."

Somerville was more emphatic. Asked if she will win, there is an unhesitating: "Yes".

A Lothians list MSP from 2007 to 2011, Somerville would love to return to Holyrood, and clearly has a hunger for the job driving her on.

However, she hasn't given up her new job as director of communities for Yes Scotland, merely taken a leave of absence that would let her return if she lost on October 24.

And Salmond is right to be wary - he won't have forgotten the 2008 by-election in the nearby Westminster seat of Glenrothes. Coming weeks after their shock victory in Glasgow East, the SNP had high hopes of their first ever back-to-back by-election wins.

Salmond confidently declared victory in advance and boasted he had put a wager on the result. However, the SNP lost after Labour savaged their candidate, Peter Grant, the then council leader.

Labour's twin-track, head-and-heart attack used an emotive local issue - council carehome charges - and a national financial one - the SNP's now abandoned plan for a local income tax. The Nationalists never knew what hit them.

Now Labour are running Fife Council, and the SNP copying the Labour playbook from Glenrothes.

Instead of carehomes, the Nationalists are making schools the local hot-button issue. "Save Our Schools" screams the headline on the SNP's by-election newspaper, The Fifer (even the title is the same as that put out by Labour in Glenrothes). And instead of tax, the national issue is universal public services - what the SNP now dub the "People's Policies" - and which they say are under imminent threat from Labour.

Because Lamont's internal party review of public services hasn't ruled anything out, the SNP claim it could mean charges galore, including a return of tolls on the Forth Road Bridge. There is no evidence of new tolls, but it's a good scare story, and the SNP is using it a lot.

Nor, for all the talk of a positive campaign, is Somerville averse to taking a pop at her rival, who she implies is a shallow Labour cut-out.

Somerville said: "I understand that she doesn't speak much in the council. It's been difficult to get a handle on what she thinks about many things. She does not have much of a public profile.

"I think there's a difference of experience and knowledge of the Scottish Parliament and campaigning between the two of us."

Ominously for the SNP, the Ochil MP Gordon Banks, who masterminded Labour's Glenrothes win, has returned to take charge for Dunfermline. And he's not running a cerebral campaign.

"Dunfermline deserves better" is the sledgehammer theme on all the party's election material, referring to both Ed Miliband's recent conference slogan and the Walker debacle.

An avalanche of leaflets and newsletters assert that Hilton would be a "fresh voice and fresh start", and, unlike the SNP candidate, would not be obsessed about independence if elected. There are constant, less-than-subliminal references to Hilton as a "local mum", a dig at Somerville living a couple of miles outside the constituency in North Queensferry.

But policies barely get a mention.

In person, Hilton seems as one-dimensional as her bumf, robotically shoehorning the phrases "Dunfermline deserves better" and "fresh start" into every passing sentence. But she's impressively relentless - and, like Somerville, she is ready to get personal. Seconds after condemning the SNP for "using children as a political football" in the schools issue, she talks postcodes.

"People are telling me on the doorstep they want someone who lives in the local community, someone who understands the local issues here.

"I think it's a bit much we have someone coming in from outside, who doesn't live here, whose children don't go to school here.

"I will put Dunfermline first, and I think after the carry-on we've had over the last couple of years, Dunfermline deserves nothing less."

What Dunfermline is getting is a political brawl that could well go down in legend.