Bonneville, who is currently appearing in a new series of Downtown Abbey on ITV, a period drama which was watched by 9 million viewers last Sunday, will take on the role of Mr Stink, a tramp who befriends a lonely 12-year old.
The story involves the young girl, Chloe, inviting Mr Stink to hide out in her family's garden shed. As Chloe struggles to make sure no-one sniffs out Mr Stink, she also has to cope with an over-bearing mum who is more interested in her own political ambitions than her daughter, her put-upon dad who has a secret of his own, her 'perfect' younger sister Annabelle and the nasty girls who make her life miserable at school. But, in what is described as a "heart-warming and comic tale", Chloe soon discovers she is not the only one harbouring a secret and there is certainly more to Mr Stink than meets the eye... or nose.
Walliams is adapting his book to become a one-off 60 minute family comedy for BBC One with the help of Simon Nye. The Men Behaving Badly writer also recently worked on bringing the latest version of Just William to screen.
Walliams will appear in Mr Stink too, taking a cameo as the Prime Minister. Meanwhile Run, Fatboy, Run actor Harish Patel will play middle-aged newsagent Raj. The casting for the role of Chloe and her family have yet to be announced.
Filming on Mr Stink will begin in October on location in London with the show expected to be broadcast as part of the channel's Christmas programming in December.
Speaking about his new role, Hugh Bonneville says: "I'm delighted to be adding my own whiff to the odour that emanates from David Walliams... and his very funny, touching and thought-provoking story."
David Walliams adds: "I am thrilled that Hugh is playing Mr Stink. He is one of the most popular and talented actors around, and is the perfect person to bring out the character's humour and sadness."
The original Mr Stink book, Walliams' second novel for children, has sold over 250,000 copies since its publication in 2009. Yesterday it was announced that Walliams had made the shortlist for the Roald Dahl funny prize for the third time in five years with Gangsta Granny, his new tale about a grandmother who behaves in unexpected ways. This year's winner will be announced at a ceremony in London on the 6th November.
Walliams can next be seen on screen as Rupert Baxter in Blandings. He is also making a new comedy for BBC One called Autumn Leaves. Due to broadcast in 2013, the series is a sitcom set in the staff room of an urban secondary school.