David Brenner got the last laugh by writing a hilarious last will and testament that reads, “All I want is a small stone on the grave site with these words; ‘Here lies David Brenner. He lived, he died, but MAN DID HE LIVE!’ ”

Brenner, who died in March of cancer at 78, wrote the will in 2006, leaving everything to his three children, except for $500,000 he bequeathed to Kenneth Cole, the fashion designer married to Maria Cuomo.

Herb Nass, the lawyer who filed the will yesterday in Manhattan Surrogate Court, said, “Kenneth Cole is a remarkably generous and charitable man who was a close friend of David Brenner’s.”

Neither Brenner’s ex-wife nor the mother of his oldest son, nor his widow Ruth, is mentioned in the document, which also says of his gravestone: “On the flip side I want ‘If this is supposed to be a joke — I don’t get it.’ ”

Though he was born and raised in Philadelphia, Brenner wrote, “I desire to be buried in or as close to New York City as possible, because this is the city of my dreams, my best times, my heart and my life.

“I request a very modest burial, no fancy box, no pillow (you think at a time like this I’m worried about a headache?), no special suit (jeans and nice shirt will be fine, but make sure my high-top sneakers are tied properly).

“Place one hundred dollars in small bills in my left sock (just in case tipping is recommended where I’m going).”

Brenner, who appeared on “The Tonight Show” more than 150 times and was beloved as a mentor to younger comics, wrote, “I give my full permission to any comedians who may think of a funny line while at the funeral to use it in his act, for I know how difficult it is to write good material. However, if any comedians are overheard doing any of my lines at the funeral, they are to be put in the box with me.”

Under “Personal Farewell” he wrote, “To those who have been kind to me and have loved me, I thank you. To those who were not kind to me and didn’t love me, I hope you’re next!”