'Everyone gets banged up in the Bastille' … an engraving of the branding of the Comtesse de La Motte-Valois.
Photograph: Universalimagesgroup/Getty Images

Even by the unusual standards of Versailles, this was one big, ugly necklace: comprising 647 diamonds weighing 2,800 carats, it was, writes Jonathan Beckman in this glittering and gloriously goofy tale of intrigue at the court of Louis XVI, "grotesque and almost literally unbearable", resembling less a priceless piece of jewellery than "an item of chain mail, or something a monk might wear in penitential self-chastisement". Dazzling as it was, however, the object itself pales besides the chaos it wrought. The Affair of the Diamond Necklace, as the audacious scam in which it starred became known, would cost a cardinal – Louis de Rohan, prince-bishop of Strasbourg, head of the French church, scion of one of France's leading families – his career, and ultimately, if indirectly, a queen her head.

Eminent writers, including Alexandre Dumas, Goethe and Thomas Carlyle, have been inspired by this improbable sideshow to the momentous final act of the ancien regime, with its beguiling cast of rogues, dupes and schemers all scrambling for a slice of the royal action, as have French historians from the scholarly Hastier to the mighty Michelet. Beckman tells the tale with an impressive mix of historical rigour and human insight, leavened throughout by the palpable – and hugely enjoyable – glee of a gifted storyteller who knows he's on to a good 'un.

In 1784, the illustrious Cardinal de Rohan, having blotted his copybook while ambassador to the Habsburg court in Vienna some years earlier by mocking the Empress Maria Theresa, found himself back in France, languishing in bad odour at court: Marie Antoinette, Maria Theresa's daughter, had sworn not to speak to him again. Unless Rohan could worm his way back into the queen's affections, his dreams of becoming a latter-day Richelieu or Mazarin would never be realised. Then he met Jeanne, Comtesse de La Motte-Valois.

Born a quarter of a century earlier, Jeanne (pictured) was descended from Henry II via an illegitimate and then destitute branch of the Valois family, the dynasty that preceded the Bourbons. Raised in poverty by a mother who (she said) beat her with a stick wrapped in nettles, Jeanne made the most of her antecedents as a child beggar before convincing a local count of her story and landing a home in his chateau, with a small pension from the king. But she wanted more and, hitched now to a willing but not overly bright husband, moved to Paris, and then Versailles, to plead her case at court and win back the riches she considered rightly hers.

Jeanne's encounter with Rohan was written in the stars, delivering an eager and stupendously gullible dupe into the hands of a cunning, if not particularly cautious, schemer. In essence, the Comtesse's plan was to kid Rohan that she was a bosom confidante of the queen's, so could broker a reconciliation – in exchange for a little pecuniary help.

Astonishingly, for a while at least, it worked. A string of letters on blue-bordered paper, purporting to be from Marie Antoinette but in reality dictated by Jeanne and forged by Rétaux de Villette, an obliging messmate of her husband's, convinced Rohan that the queen was prepared to let bygones be bygones and he might soon even be promoted to prime minister.

The cardinal – along with several other equally desperate cases whom Jeanne had managed to convince of her intimate relationship with a woman she had never actually met – were happy to fork out small fortunes to the fake go-between in the hope she could help secure them preferment at court.

Arguably Jeanne's greatest triumph was to engineer a rushed and all but wordless meeting, at midnight on a parterre of the palace of Versailles, between a doubtful Rohan and a woman he believed to be Marie Antoinette, but who was, in reality, a cunningly disguised, carefully coached and handsomely rewarded prostitute.

But then came that big, ugly necklace. To the considerable distress – not to mention financial embarrassment – of its makers, Marie Antoinette did not like it. Jeanne, though, saw her chance. Rohan was informed that the queen in fact adored it, but regretted she was unable to buy it herself because the king, bore that he was, wouldn't approve: so might her trusted Rohan act as intermediary? Could he in fact negotiate the necklace's purchase, with his money (he would, of course, be reimbursed), then deliver it to her via her dear friend, the Comtesse de La Motte-Valois?

Pretty much from that point on, Jeanne's plans went pear-shaped. The ever-credulous Rohan did as he was told and Jeanne's husband flogged the stones for a fraction of their value in London. But the suspicions of both the jeweller and the cardinal were finally aroused when the queen failed to wear the necklace in public, as her letters promised she would. A graphologist confirmed Rohan's direst doubts, the king got wind of the whole affair, and everyone was banged up in the Bastille.

A big chunk of Beckman's book is devoted to the ensuing trial, which lasted nine months and captivated all France – and, for that matter, Europe; in London in 1786, taverns charged their customers five shillings merely for a look at Jeanne's portrait. Given that many of the incriminating documents (including the forged letters) were burned before the trial started, and that once it was under way most of the accused lied through their teeth, he does a fine job, managing at once to sift the evidence and keep his story vividly alive.

But what happened to our heroes? Rohan, a fool but not really a felon, was acquitted, albeit narrowly, exiled, and later restored. Jeanne was found guilty, flogged, and branded on each shoulder with a letter V (for "voleur"). She ended up in prison, from which she soon escaped, and finally died in 1791, in England where she had fled to rejoin her husband, after jumping from a window trying to escape her creditors.

This is a terrific tale, told – bar the occasional minor infelicity – with assurance and gusto. Rightly, Beckman also underlines its historical significance: the French were all too willing to believe their queen was up to her neck in the scandal – and even if she wasn't the lies, slanders and sordid truths swirling around confirmed their conviction that the Bourbons were not the infallible and "uniquely glorious individuals" the ancien regime required them to be.

Wacky as it was, Beckman argues, the whole affair proved a "defining pedagogic moment" for France, in which a people were "educated in ways of interpreting their rulers' actions that would fundamentally guide the dynamics of the revolution". Napoleon was not alone, years later, in reflecting that the death of Marie-Antoinette "must be dated from the Diamond Necklace trial".

• To order How to Ruin a Queen for £15 with free UK p&p call Guardian book service on 0330 333 6846 or go to guardianbookshop.co.uk.