* Top UK author Hilary Mantel compares Kate Middleton to mannequin
* Says "painfully thin" princess's only job is to provide heir
* Prime Minister Cameron says Mantel is "completely wrong"
* Mantel examined role of royal women over the centuries (Adds Cameron; royal visit; public reaction)
By Clare Hutchison and Peter Griffiths
LONDON, Feb 19 (Reuters) - One of Britain's most celebrated authors has launched a withering attack on the Duchess of Cambridge, the pregnant wife of Prince William, branding her a "shop-window mannequin" with a plastic smile whose only role in life is to breed.
Prime Minister David Cameron described award-winning writer Hilary Mantel as "misguided" after she likened the former Kate Middleton to a "machine made" doll, devoid of personality.
Her comments about the 31-year-old wife of William, second-in-line to the British throne, divided public opinion, with newspapers condemning Mantel as "venomous", "cruel" and "staggeringly rude".
Supporters said her words had been taken out of context from a long analysis of society's centuries-old obsession with the appearance and fertility of royal wives that ended with a plea to "back off and not be brutes" to them.
"I saw Kate becoming a jointed doll on which certain rags are hung," Mantel said in a lecture at the British Museum in London earlier this month in which she spoke about her changing view of the princess.
"She was a shop-window mannequin, with no personality of her own, entirely defined by what she wore. These days she is a mother-to-be, and draped in another set of threadbare attributions."
Speaking during a visit to India, Cameron said Mantel was wrong and that people should do more to encourage a young royal who is a "fantastic ambassador for Britain".
"She writes great books, but I think what she's said about Kate Middleton is completely misguided and completely wrong," Cameron told Sky News.
Mantel, who last year became the first Briton to twice win the Man Booker prize for fiction, referred to the princess's severe morning sickness during the early stage of her pregnancy and said her role was to provide an heir.
"Once she gets over being sick, the press will find that she is radiant. They will find that this young woman's life until now was nothing, her only point and purpose being to give birth," Mantel said in the lecture organised by the London Review of Books on Feb. 4. The literary magazine reprinted the lecture on its website this week.
A smiling Duchess of Cambridge showed no sign of being affected by the row when she visited an addiction charity in London. Wearing a grey wrap dress, she crossed her hands over her small baby bump as she chatted to charity workers.
Well-wishers who waited in the late winter sunshine for a glimpse of her expressed sympathy.
"It's totally uncalled for," said Morag Hamilton, 36, from London. "It's a shame - that's what her life is going to become now.".
Mantel, 60, is best known for her historical novel "Wolf Hall", about the rise of blacksmith's son Thomas Cromwell to the pinnacle of power in King Henry VIII's court. Her follow-up "Bring Up the Bodies" recounted Anne Boleyn's fall from grace after failing to give Henry a male heir.
In her lecture, Mantel said the Duchess of Cambridge was "selected for her role ... because she was irreproachable", contrasting her with the "emotional incontinence" of William's late mother, Princess Diana.
"As painfully thin as anyone could wish, without quirks, without oddities, without the risk of the emergence of character. She appears precision-made, machine-made, so different from Diana," Mantel said. The author's agent and a royal spokeswoman declined to comment.
Reaction on Twitter suggested Mantel had split public opinion. Royal commentator Robert Jobson said the "venomous attack" was "unfair and publicity-seeking". Others agreed with Mantel, saying she had elegantly articulated what many people had long thought about the royals.
The lecture looked at the public fascination with the "regal body", examining the lives of royal women and the importance of providing an heir. Mantel compared their fate to caged pandas in captivity.
"Our current royal family doesn't have the difficulties in breeding that pandas do, but pandas and royal persons alike are expensive to conserve and ill-adapted to any modern environment," Mantel said. "But aren't they interesting? Aren't they nice to look at?" (Additional reporting by Andrew Osborn in New Delhi; Editing by Guy Faulconbridge and Paul Casciato)