Leona Helmsley’s pet pooch, Trouble, is going from rich bitch to good dog by throwing a $10 million bone to charity.

A Manhattan judge quietly reduced the notoriously ill-tempered canine’s $12 million trust fund and signed off on a deal to pay the late billionaire’s two disinherited grandchildren $6 million amid allegations that Helmsley wasn’t mentally competent when she signed her will.

Trouble now will have to get by for the rest of her life on a measly $2 million.

While Helmsley, who died last August, was exceedingly generous to her 9-year-old Maltese in her will, she pointedly excluded grandkids Craig Panzirer, 40, and Meegan Panzirer Wesolko, 37, “for reasons which are known to them.”

In bombshell papers filed in Manhattan Surrogate’s Court, the siblings say the so-called Queen of Mean was not of sound mind or memory and did not have the mental capacity to make a will when she signed the document on July 15, 2005.

She died at 87.

The grandchildren quietly worked out a deal with the executors of Helmsley’s estate in March. Under its terms, the grandchildren withdrew their objection in return for some changes to Helmsley’s will.

Those alterations include Panzirer receiving a tax-free $4 million bequest and Wesolko a tax-free $2 million bequest. The estate will also cover their legal fees, the deal says.

Their two other brothers, Walter and David, see their $10 million bequests from Helmsley reduced to $9.5 million, while Helmsley’s brother, Alvin Rosenthal, has his $15 million inheritance cut by $1 million.

Panzirer and Wesolko agreed not to ever speak publicly concerning their disputes and to turn over all their financial and legal documents related to their grandmother’s affairs.

The highly unusual deal was signed off on by both the state Attorney General’s Office, which oversees charities, and Surrogate’s Court Judge Renee Roth.

Wesolko did not return a call for comment, and Panzirer and the executors declined comment.

In an apparently unrelated move, the trustees of Trouble’s kennel-full of cash said the persnickety pooch doesn’t need the full $12 million she was left.

They received permission from Roth to reduce the fund by $10 million, which will go into Helmsley’s multibillion-dollar charitable foundation.

Helmsley’s will had asked that either her brother or grandson David Panzirer care for the dog, but both passed on tending the notoriously bitey beast.

Trouble is living in Florida with Carl Lekic, the general manager of the Helmsley Sandcastle Hotel.

In an affidavit, Lekic says Trouble appears to be very happy in her new permanent home and is doing well in all respects, and the extra cash wouldn’t buy her more happiness.

“Two million dollars . . . would be enough money to pay for Trouble’s maintenance and welfare at the highest standards of care for more than 10 years, which is more that twice her reasonably anticipated life expectancy,” he said.

Lekic put her annual expenses at $190,000, which includes his $60,000 guardian fee, $100,000 for ’round-the-clock security, $8,000 for grooming, $3,000 for miscellaneous expenses, $1,200 for food and anywhere from $2,500 to $18,000 for medical care.

dareh.gregorian@nypost.com