David Cameron and Nigel Farage are to be issued with a joint challenge to declare that they will rule out any attempt to repeal the ban on foxhunting if they form a pact in the event of a hung parliament.

As thousands of people take part in the last Boxing Day hunts before the general election, Labour has written to the prime minister and the Ukip leader to ask them to issue a pledge that they will not repeal the Hunting Act.

Cameron and Farage, who would both be deeply wary of any alliance between the Tories and Ukip in a hung parliament, are both opponents of the ban on foxhunting introduced by the last Labour government in 2006.

The prime minister, who described the Hunting Act as “unworkable” in the Tory manifesto for the last election, agreed with Nick Clegg in their coalition agreement in 2010 to hold a free vote in the House of Commons to repeal the statute. But a vote has never been held because the Tory leadership would be unable to muster the numbers for a change in law.

Farage believes that a series of referendums should be held county-by-county to give local people a chance to decide whether to repeal the ban.

Labour wants to highlight a possible threat to the hunting ban by issuing a joint challenge to Cameron and Farage. The League Against Cruel Sports has suggested that only 21 Tory MPs would vote to retain the statute. This means that if Ukip holds – and then adds to – the two seats it won in the Clacton as well as Rochester and Strood byelections, it could influence a Commons vote on hunting.

In letters to the two leaders, the shadow Cabinet Office minister Jonathan Ashworth writes: “Given your parties respective stances on foxhunting, and given that 80% of the public back the hunting ban, I am writing to ask if you will rule out the possibility of a vote on the repeal of the Hunting Act as part of a 2015 post-electoral deal.”

Labour is issuing the challenge because it believes that the Tories might be forced to form an alliance with Ukip if Cameron emerges as the leader of the largest party in May’s general election but fails once again to secure an overall majority in the Commons. Cameron and Farage would be deeply wary of forming any kind of alliance. The prime minister regards Ukip as wholly untrustworthy and rejects Farage’s demand for an immediate post-election EU referendum on the grounds that the Ukip timetable would not give him enough time to renegotiate Britain’s EU membership terms.

Farage does not trust Cameron because he believes the prime minister is determined to maintain Britain’s membership of the EU. The Ukip leader’s best hope after the election is for Cameron to be dislodged as prime minister by Ed Miliband, allowing a more Eurosceptic figure to assume the leadership of the Tory party.

Labour is highlighting pressure from Eurosceptic Tories, including Peter Bone and Jacob Rees-Mogg, for a pre-election pact with Ukip. This has been ruled out by both Farage and the Tories.

But a post-election alliance could come into play in a hung parliament. Ukip has said it would be prepared to consider a “confidence and supply” arrangement with Labour or the Tories, in which it would vote in favour of the Queen’s speech and budget in return for an immediate EU referendum.

Ashworth said: “David Cameron is so out of touch he wants to bring back hunting. While there is a cost-of-living crisis for hardworking families, he has got his priorities all wrong.

“The Tories are racing off to the right and into the arms of Nigel Farage. A Tory-Ukip pact would mean even more tax cuts for millionaires, increased privatisation of our NHS and the return of foxhunting. Labour is the only party which stands up for working people.”

A Ukip source said: “The only thing Nigel Farage is talking about is getting an EU referendum. Everything else is irrelevant. We are opposed to the Hunting Act but its repeal is just not a priority for us in any confidence and supply deal.”