Recent advances in malice and technology have encouraged the new industry of “reputation management”, in which strategies and algorithms are used to burnish the public profile of a maligned character. Sarah Dunant attempts a literary equivalent by boldly basing a novel around two of the most notorious figures in history: Lucrezia Borgia (1480-1519) and Niccolò Machiavelli (1469-1527).

His surname has been immortalised as an adjective for clever and deceitful ambition, especially in politicians and diplomats, while a Donizetti opera and assorted TV miniseries have established her as a mass murderer who also slept with most of the men in her own and other leading families.

Those reputations, though, are skilfully managed by Dunant in the fifth of her sequence of novels set in Italy during the Renaissance. Continuing a reclamation that began in the previous novel, Blood and Beauty, this Lucrezia has “sweetness and modesty”, and is disarmingly nervous as we observe her on the eve of her third marriage, by which she will become Duchess of Ferrara.

As for Niccolò, those who have read The Prince – or observed the various politicians or football managers influenced by that treatise on statecraft – may be surprised to find its author panicking during a meeting with Cesare Borgia, Lucrezia’s brother, who, in the main action of the novel, grabs more kings and bishops for the Borgias on “the chessboard of central Italy”. What worries Niccolò is that Cesare is “a man who never does what anyone expects”. In other words, the other guy is being a bit, well, Machiavellian.

But, while offering new perspectives on two long-defamed names, Dunant is unsparing in her presentation of the fabled derangement of the period. Readers in an era when the papacy has come to stand for celibacy and pacifism can only goggle at the spectacle of Pope Alexander VI, born Rodrigo Borgia, who is running almost as many wars and whores as he has children. Frequent pleasure comes from Dunant’s sly employment of lines that now read counterintuitively, as when Lucrezia thinks of “The Pope. Her Father.”

Due to Rodrigo’s profession, the novel is in part an ecclesiastical thriller, a sort of House of Cardinals, charting power struggles. Machiavelli, currently under-secretary in Florence, French-protected but coveted by the Borgias, is among the many diplomats, ambassadors and spies in the cast. Characters are regularly found writing or reading dispatches, reports and intelligence.

Even Lucrezia’s latest wedding night is watched by officials, who scribble reports for distribution across Europe, calculating the likelihood of conception by the intensity of pleasure overheard. But these communications are often dubious. The words “gossip”, “scandal”, “rumour” and “slander” echo through the text like an endless whisper.

‘Niccolò’s surname has been immortalised as an adjective for clever and deceitful ambition.’ Photograph: Imagno/Getty Images

History, Dunant clearly suggests, can just be the rumour that stuck, which is why she questions some of the scuttlebutt on Lucrezia and Machiavelli, and even Pope Alexander VI, who, although he remains a squalid monster of hypocrisy, is also, in his own way, not a bad dad.

A risk of historical fiction is that the people become museum pieces, defined by their clothes, furniture and funny words. Dunant’s characters copulate, defecate and menstruate with visceral physicality; they catch colds and suffer constipation, sweat from fever, shiver from cold, and scratch at pox-scabs. Astute use of the 42 reference works listed in a bibliography allow her to tell us what prostitutes used for contraception – “a prepared flask of liquid, bitter and fat with grease” – and how people cleaned their teeth, “with a rag soaked in rosemary and vinegar”.

The story proceeds through a succession of tremendous set pieces, including a sea storm, a plague, the delivery of a child and various skirmishes as the pope and his children seek to tighten the “Borgia belt” around Italy. Dunant’s historical reinterpretation and bodily realism recall Hilary Mantel’s Tudor novels, and seem to nod to them in the application to Machiavelli of a viewpoint-pronoun – “He, Niccolò” – modelled on the one Mantel favoured for her slippery courtier, Thomas Cromwell. In the Name of the Family also overlaps with Mantel’s historical project in its sympathetic presentation, through the unusually nuanced presentation of Lucrezia, of what it might have been like to be a courtly wife, on whose breeding and bleeding empires might rise or fall.

Dunant, though, has made completely her own the story of Italy’s most infamous ruling family. Retaining the knack for plotting and pacing from the crime novels that began her career, she depicts history in a way that we can see, hear and smell. The ageing pope on his boat worries that “his grasp of history is becoming blurred inside the accelerated creation of his own myth”. Identifying historical blurrings and myths about the period, Dunant’s Italian novels are an enthralling education. Her status as a writer needs no reputation management.

In the Name of the Family is published by Virago. To order a copy for £14.44 (RRP £16.99) go to bookshop.theguardian.com or call 0330 333 6846. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99.