Robert F. Kennedy Jr.’s estranged wife, Mary, who battled her husband’s rumored philandering by turning to alcohol and prescription drugs, hanged herself in a barn on their Westchester estate today, sources told The Post.

The 52-year-old mother of four — the latest victim of a family dynasty cursed with tragedies — may have taken her own life because she was haunted by her broken marriage, her friends lamented.

“She was deeply troubled, abusing alcohol and prescription meds,” a close family friend said. “She had cause. She was used up and tossed away by Bobby. That was awful.”

Officials refused to elaborate on her death and said it would be investigated with the help of the Westchester Medical Examiner’s Office.

Bedford police responded at 1:36 p.m. to a report of a “possible unattended death” — meaning there were no witnesses — at the estate.

Mary was found “inside an out-building on that property,” police said in a statement.

There are several sheds behind the home — some hold garden tools and another is a falcon house — on a slope leading to a lake.

The Kennedy family dealt stoically with the latest in the long line of shocking deaths.

“We deeply regret the death of our beloved sister Mary, whose radiant and creative spirit will be sorely missed by those who loved her,” the family said in a statement.

“Our heart goes out to her children, who she loved without reservation. We have no further comment at this time.”

A grim-faced Kennedy showed up at the house around 8 p.m.

The third of 11 children of former US senator, attorney general and presidential candidate Robert Francis Kennedy, he married Mary Richardson in 1994 one month after his first marriage ended after 12 years.

The wedding ceremony took place aboard a research vessel on the Hudson River, a fitting location for the couple, who were environmental advocates.

A family friend said Mary had known the Kennedy clan long before she married Bobby and had been a close friend of his sister, Mary — known as “Kerry” — since they were 15-year-olds.

“She had grown up with the Kennedy family, having been Kerry’s best friend since they were teenagers.”

But the marriage broke down amid reports of her addiction and rumors of his involvement with other women.

“She knew Bobby her whole life, and now he rejected her. Tragic,” the family friend said.

Kennedy, 58, filed for divorce on May 12, 2010, two days after Mary called the cops to complain about her husband — but she appeared “visibly intoxicated” when cops arrived, according to police reports.

As of today, the divorce was not finalized, TMZ.com reported. But Kennedy has since been dating actress Cheryl Hines, sources said.

A day after the divorce filing, Bedford police were again called to the home because of a report of a “domestic incident” in which Mary was reportedly drunk.

Two days later, she was charged with driving under the influence when she was caught speeding down the Taconic State Parkway. Her license was suspended.

But members of the family rallied to her support — even during her steep decline.

Ethel Kennedy, her mother-in-law, sent a handwritten letter to a town justice, seeking leniency and calling Mary a “kind, loving and generous person.”

Cops confirmed then that they had been called to the estate several times in the previous years.

Mary’s close friend pointed to the strain of her 18-year marriage.

“She was lovely. She always looked out for you,” she said, but added, “She did not have it easy, being Bobby’s wife.

“I remember being seated at a dinner next to Bobby around 10 years ago that she was also at — it was the first time I had met either of them — and he put his hand on my thigh under the table. We hadn’t even spoken but to say hello. He is such a dog that way.”

The friend, who requested anonymity, alluded to the problems of other women who married into the fabled clan: “Like all Kennedy wives, she was expected to tow the line. Stay quiet, take care of the kids, tolerate the affairs and look happy. She took solace in yoga and meditation.”

Still, the alleged philandering took “a terrible toll,” the source said.

“He got all the glory, and she got no acknowledgment for what she did: holding it all together at home.”

Kennedy rarely spoke about his private life but opened up to Oprah Winfrey in a 2007 interview.

“Pretty soon after my dad died” — referring to his father’s assassination in 1968 — “I started taking drugs,” he said. He said after overcoming his addiction he became an environmental advocate. Mary, who had worked as an architect before her marriage, took up the same environmental causes and tried to turn the Bedford estate into a showcase, according to her friend.

“She was a gentle soul. She was very proud of how she had turned their family home into the truly greenest/eco-friendly home ever. It was all solar panels and water regeneration and more,” she said.

The friend said Mary readily took over caring for the two children from her husband’s first marriage — and then raised four of her own.

“She was a good mother. Like so many parents of Kennedy kids, she was dealing with a wild bunch. The kids were always getting into scrapes, and Mary was forever rescuing them,” she said.

Additional reporting by C.J. Sullivan and Lois Weiss