A 13-year-old boy has been arrested in the fatal stabbing of Barnard College freshman Tessa Majors — as new details emerged Friday about the murder.

Law enforcement sources told The Post the teen confessed to detectives that he and two of his middle-school buddies headed out Wednesday evening planning to pull off a string of muggings.

The menacing young trio first targeted a man in Morningside Park, near Barnard, in Manhattan, but for some reason, they got scared off, sources said.

Then they spotted Majors, a Virginia native and musician, near stairs at the park around West 116th Street and Morningside Drive, sources said.

The teens snuck up behind the 18-year-old woman, grabbed her and swiped her bag before stabbing her, sources said.

“He said they tried to rob her. Then she was stabbed, and she died,’’ a source said. “They were trying to rob her, she resisted, and they stabbed her.’’

At one point during the robbery, one of the suspects snarled, “Give me the phone!,’’ sources said. Majors’ bag was not on her when cops found her body, but her phone was discovered nearby — which is how she was identified, sources said.

The 13-year-old claimed that one of his two cohorts did the stabbing, law enforcement sources said.

He gave detectives two first names. All three boys attend nearby MS 180, sources said.

The boy was picked up late Thursday afternoon in the lobby of a building close to the park, as police were canvassing for suspects, a high-ranking police source said.

His clothes matched what cops saw on surveillance footage from the crime scene, the source said. He had a knife on him, although it is not clear whether it was involved in the crime, the source said.

The boy was taken to the 26th Precinct, where he laid out for investigators what had happened, sources said. His aunt, his legal guardian, was with him, they said.

The boy’s mother is dead, neighbors said.

Police charged him with felony murder, first-degree robbery and fourth-degree criminal possession of a weapon, sources said.

A neighbor of the teen, who lives on Lenox Avenue, a few blocks from Morningside Park, said he was stunned to hear of the boy’s alleged crime.

“I knew his mom before she passed. [The boy] didn’t seem like that type of individual who would kill somebody,’’ said Raymond Sears, a 46-year-old food-service worker, adding that the teen was close with his mother.

“He’s just a normal person,’’ Sears said of the suspect. “Any time I come by, I’m like, ‘Yo, what’s going on, Shorty?’ You know I call him [that][ ’cause he’s short.

“He just hangs out, he smokes weed, just a normal person in my eyes.”

“He smokes his little weed, who doesn’t nowadays?’’ Sears added.

“ He never seemed like a violent person. … He always seemed like a calm individual. He was a good kid. I don’t know how he got involved in this.

“He should be involved in school activities, anything other than that, killing somebody or being involved in a murder.”

Mayor Bill de Blasio told WNYC host Brian Lehrer on Friday morning, ”There’s a lot we cannot say because it might undermine the immediate work to bring these perpetrators to justice. But the bottom line is, I am absolutely confident that any individuals involved in this terrible, heinous attack will be brought to justice and will be brought to justice quickly.”

After the stabbing, Majors was rushed to Mount Sinai St. Luke’s Hospital, where she died.

Brett Holtz, a junior psychology major at nearby Columbia College, called the murder “really sad.”

“It’s not something that’s expected at all,” he said. “This is finals time, holidays, when people are about to be with their families. [The suspect] is 13. It’s nothing you expect.”

Paulina Pinsky, 27, a writer who went to Barnard as an undergrad and has lived in the area her whole life, said, “I think about that 13-year-old. I think about how desperate he must have been for something.

“My sympathy lies with the girl who died,” Pinksy added. “I can’t imagine what it must be like being a freshman and having your roommate brutally murdered. It could have been any of us. You walk around here at Barnard, a place you worked your whole life to get to, and you think you’re immune to everything, but life can be snatched away from you at any moment, no matter how privileged you are.”

A 13-year-old suspect cannot be tried as an adult.

He was awaiting arraignment in Manhattan family court.

Additional reporting by Julia Marsh and Rebecca Rosenberg