Bad lock … Margaret Thatcher keyrings for sale at the Conservative Party conference 2016 this month. Photograph: Matt Cardy/Getty Images

Margaret Thatcher has narrowly beaten David Cameron to be named the worst prime minister of the past 100 years by historical writers.

The Historical Writers’ Association surveyed its membership on their views of the 19 prime ministers who have led the UK since 1916, in advance both of this year’s Harrogate History festival later this week, and Theresa May’s 100th day in office on 22 October. Thatcher, who died in 2013, came in first with 24% of the vote, followed by Cameron (22%) and Neville Chamberlain (17%).

Authors singled out Thatcher’s attitude to society as a chief problem with her premiership. “She destroyed too many good things in society, and created too many bad ones, then left a social and moral vacuum in which the selfishly rich and unimaginatively fortunate could too easily destroy still more of what they don’t need and can’t see that everyone else does need,” said the writer Emma Darwin.

“Thatcher made the idea of society, in the sense of a community that cares for all its members and accepts the premise that people need support and should not be stigmatised for it, an anathema,” wrote historical novelist Catherine Hokin in her response. “It is easy to demonise politicians and resort to ad hominem rather than policy attacks, but Thatcher encouraged the worst behaviour across all aspects of society and we are still reaping her poisoned harvest.”

But Paddy Ashdown, former leader of the Liberal Democrats, begged to differ: “I disagreed with Mrs Thatcher, I fought her all the way. But I thought she was a great and necessary destroyer. Some of those old structures she pulled down had to be pulled down, but what she wasn’t was a builder.

“Oddly enough, this will offend some, I put her down as one of the most successful PMs of all time, not because I agreed with her, but because she laid out her stall and she achieved it, and Britain in many ways was stronger afterwards – although in many ways it was also weaker, particularly our sense of communities,” said Ashdown, who will speak at the festival later this week about his latest book, Game of Spies.

Former HWA chair Manda Scott said she voted for Thatcher for reasons of “neoliberalism, de-industrialisation, free-market ideology, Scottish poll tax, selling council houses and failing to act on early stages of global warming”, while the historical crime writer DE Meredith said that Thatcher “spawned a terrible lack of compassion at the heart of British politics, which we still live with today”, pointing in particular to her quote: “There’s no such thing as society.”

Tony Blair was in fourth place, with 11% of the vote, followed by Gordon Brown and Edward Heath with 8% each. Anthony Eden, Herbert Henry Asquith and Andrew Bonar Law were all tied, with 2% of the vote. The remaining 10 PMs were not nominated by any of the 45 writers who responded to the survey.

According to Ashdown, the second-placed Cameron was “one of the most dangerous prime ministers we’ve had, not because he’s not a decent man, he’s a very decent man, but because he just didn’t think, in his casual Eton-bred insouciance, about taking this huge and vitally important decision for Britain”.

Others agreed with the politician turned writer’s assessment of the former PM. “David Cameron is a mediocrity who’s single-handedly brought on the UK’s biggest crisis in 75 years,” said the author Tom Harper, programming chair of the Harrogate History festival, which will take place from 20-23 October. “Neville Chamberlain had to contend with Hitler, Eden with Nasser: Cameron couldn’t see off Nigel Farage.”

“He gambled with the country’s future prosperity and lost,” added novelist Angus Donald. “Then ran from the battlefield leaving the rest of us to pick up the pieces.”

But the third-placed Chamberlain was Ashdown’s personal choice for the “worst prime minister” label. “I think Chamberlain could have personally prevented the second world war,” said Ashdown. “He was certainly warned by the German opposition what Hitler was and he chose to ignore it, and the consequence was eight million people dead. I don’t blame him for those deaths but I remain of the view that if he’d taken the right decision, as he was encouraged to when Hitler invaded Czechoslovakia, the second world war would not have happened.”