An unhinged Brooklyn man accused of punching seven women — including a 78-year-old — in brutal “knockout” attacks last year told cops he attacked six of them in “self-defense,” and hit another woman because she almost made him spill his Dunkin’ Donuts coffee, court papers revealed Wednesday.

Barry Baldwin, 35, hit the women in seven separate attacks in Canarsie and Midwood between Nov. 7 and Dec. 27, court papers state.

His Jan. 3 arrest came in the midst of a slew of possible “knockout game” attacks — in which innocent people are sucker-punched by thrill-seeking punks — including multiple attacks against Orthodox Jewish and Hasidic people in Brooklyn and a rash of attacks on Long Island.

He was arraigned in a brief Brooklyn Supreme Court appearance Wednesday.

“I hit a lady on the head in self-defense,” Baldwin wrote in a statement to police when asked about the Nov. 7 attack, according to court papers.

The women he attacked were between the ages of 20 and 78, cops have said.

Baldwin made similar written statements about self-defense when investigators asked about his attacks on Dec. 7, Dec. 24, and Dec. 26.

“I was passing by a lady using a phone and I hit her head in self-defense because of the way she looked,” Baldwin wrote of the Dec. 27 attack.

Baldwin attacked a 33-year-old mom walking with her 7-year-old daughter on Elm Street near East 12th Street on Dec. 21 in Midwood, cops said.

The surprised mom fell onto the child before crashing to the ground, cops said – and sufffered cuts and bruises to her head, hands and knees, according to Baldwin’s criminal complaint.

He had a different take. “There was a Dunkin’ Donuts beverage in his hand and the woman almost bumped his coffee so he swatted, but didn’t attack her but that she had a kid with her,” Baldwin told investigators when asked about the Dec. 21 attack.

“Defendant stated it wasn’t a whipping, but he was trying to protect his drink,” court papers say Baldwin said. “It was just a love tap.”

The crazed attacker also punched a 78-year-old woman sitting on a bench in Canarsie Park on Christmas Eve and 15 minutes later attacked another elderly woman nearby at corner of East 93rd Street and Seaview Avenue, court ¬papers charge.

“I was passing by two ladies at the Canarsie Park but I hit them in self-defense because … I was feeling ill,” Baldwin said, according to court papers.

Baldwin pleaded not guilty and walked out of court on a $13,500 bond.