SPIRALING OUT OF CONTROL: Robert F. Kennedy Jr. says in court filings that his wife, Mary, was being “hateful” to his daughter and would routinely get drunk in front of their children.Walter McBride/WM Photography

(
)

Robert Kennedy Jr.’s wife, Mary, beat him up, tried to blackmail him, killed the family dog and, finally, told a servant she needed rope for a new couch — then hanged herself with it, according to a bombshell report.

“Mary’s violence and physical abuse toward me began before we were married,” Bobby said in confidential court papers that surfaced yesterday.

“Soon after Mary became pregnant with our first son, Mary — in a sudden rage about my continued friendship with my ex-wife — hit me in the face with her fist,’’ Bobby said in an affidavit filed as part of his then-custody battle with his estranged wife.

“She was a trained boxer, and I got a shiner,’’ Bobby said. “Her engagement ring crushed my tear duct, causing permanent damage. Mary asked me to lie to her family about the cause of my shiner.”

Bobby said that at one point after they separated, Mary “said she intended to kill herself unless I called off the divorce and unless I promised to recommit to the marriage.’’

He admitted he started cheating on her — but hinted it was her own fault because of her behavior.

He added to the judge that despite years of her abusing him, “she repeatedly says she will call the police and say that I beat her if I threaten to leave her.’’

The sealed, 60-page document was obtained by Kennedy historian Laurence Leamer, who reported on the contents in the new issue of Newsweek.

In addition to quoting the court papers, the magazine also said that in the weeks before she died, Mary Kennedy asked her housekeeper’s husband to buy her a rope — supposedly for a couch she was making. She then combed the Internet for tips on constructing a noose.

Bobby, the housekeeper and her husband found Mary’s body hanging from a barn rafter May 16 at the family’s Mary’s Westchester estate, sources told the magazine.

At the time, the mother of four was facing the real possibility of losing custody of her children to her estranged husband as she grew increasingly erratic and drank more often, according to her housekeeper.

One day, “I saw her in the kitchen, like, with her head down, and I was like, ‘Oh, golly, she’s talking on the phone and crying,’ ” recalled the maid, who has lived with the Kennedys since their 1994 marriage.

“But then I got close to her, and she was passed out. The plate of food was old, and her face was on top of the plate. And that day, she was drinking a lot,” the woman told Newsweek.

In the three days leading up to her death, Mary rarely got out of bed, the maid said.

Mary had become increasingly despondent over Bobby’s May 2010 divorce filing.

In his confidential affidavit, Bobby had claimed that Mary continued to physically attack him even after he moved out, recounting a May 2011 incident in which Mary asked him to come console the kids over their dead dog.

“Mary ran over and killed the dog, Porcia, in the driveway,” he said in the affidavit. Arriving at her house, he found her drunk, with their son Aidan in the room.

“I opened the door, and she leapt out of her bed and hit me with a roundhouse punch that, had I not blocked it, would have undoubtedly broken my face,” Bobby claimed.

She was “raining blows down on me as I backed down the hall,” landing about 30 blows in all, he said.

“She screamed at Aidan as she hit me, [saying, I’m] ‘a demon. He is the most evil man in the world. Everything he does is evil and a fraud. He is a philanderer, an adulterer, a sex addict.’ ”

According to the affidavit, during their marriage, Bobby would awaken in the middle of the night to find Mary beating him, and he said that he once had to escape through a second-floor window.

One time, she threw a plate of spaghetti at him in front of the kids and another, attacked him with scissors while he was in the bathtub, according to the report.

RFK Jr. asked a judge to prohibit her from being drunk in front of their kids, to “stop following me on vacation trips or business travel” and to “stop stealing [my] suitcases, cell phones, prescription drugs, wallets, passports, computers . . . and other items.”

RFK Jr. also claimed Mary began secretly tormenting his daughter Kick, from his first marriage, when the girl was just 9 years old and would come for weekend visits with her dad.

On nearly every visit, Bobby said in the affidavit, Kick would lose something — such as her plane ticket or wallet.

When he told the child she had to be more careful, Kick told him, “Daddy, I think Mary is stealing from me,” he said.

Bobby said he later found a collection of Kick’s lost things in one of Mary’s dresser drawers.

Bobby claims he first decided to leave Mary in 1997, just three years after their wedding. He said he began cheating on his wife but did not leave her.

According to Newsweek, Bobby “pleaded” with Mary’s brothers and sisters to do an intervention, and e-mailed them in June 2011 that she was “sinking into terrible darkness.”

Mary’s siblings — who, along with many of her friends have contended that the Kennedy clan is trying to save face over Bobby’s mistreatment of Mary by making her look mentally ill — allegedly told him to take a hike.