The retired footballer is one of the show's biggest fans, and he happily teamed up with lead characters Del Boy and Rodney, played by Sir David Jason and Nicholas Lyndhurst.
In the special sketch, David is seen joining the Trotter brothers in a greasy spoon cafe in Peckham.
It is the first time that Sir David and Nicholas have been reunited in a decade — they last played the wheeler-dealer pair in a Christmas special in 2003.
David has taken part in a number of sketches over the years for Sports Relief, including cuddling up in bed and sharing a bath with actor James Corden in 2012.
The brief return of Only Fools and Horses is eagerly awaited by fans of the show, which ran from 1981. It was regularly voted Britain's best sitcom, and the 1996 Christmas special, in which Del Boy managed to turn the Peckham brothers into millionaires, was watched by more than 24 million people.
David has performed a sketch before for Sport Relief alongside James Corden
Sports Relief runs between 21 and 23 March. This year's TV coverage will come live from the Olympic Park, with presenters including Gary Lineker, Gaby Logan, Clare Balding, Claudia Winkleman and Jack Whitehall.
The evening will include a Strictly Come Dancing special, with four Paralympians taking on a group dance challenge in the hope of winning a Sport Relief glitter ball trophy.
Celebrity fundraisers include Davina McCall, who will attempt to get from London to Edinburgh in a week, by cycling, running and swimming lake Windermere.
Olympic cyclist Victoria Pendleton, singer Michael Ball and actress Samantha Bond are among those who have been competing in The Great Sport Relief Bake Off this month.
Little Mix will release the Sport Relief 2014 official song Word Up
And a new show, Sport Relief's Top Dog, will launch on BBC 2 in February, featuring celebrity team captains and members of the public competing to see their per crowned the winner.
Little Mix have recorded this year's Sport Relief single, a cover of Cameo's Word Up, and have just returned from a trip to Liberia with the charity.
"It was shocking to see how tough people's lives are in the slums there," said band member Leigh-Anne Pinnock.
"Knowing the money raised really does help change lives was inspiring and that's why I hope everyone gets involved, signs up to the Games and does their bit this year."
Members of the public can do their bit by taking part in a number of accessible and challenging events. The Sainsbury's Sport Relief Games include walking, running or jogging the Sainsbury's Sport Relief 'mile', a swimathon and the Sport Relief Cycle.