Two middle-schoolers, ages 13 and 14, were busted in the fatal stabbing of Barnard College freshman Tessa Majors during a robbery-gone-wrong in Morningside Park, law enforcement sources told The Post on Friday.

The 13-year-old boy, Zyairr Davis, was nabbed in the lobby of a building near the upper Manhattan slay scene Thursday afternoon, a day after the grisly murder, ­sources said. A second suspect was picked up on Friday with charges pending. A third remained at large.

When he was nabbed, Davis was still wearing the same outfit, including red sneakers, he allegedly wore during the slaying, sources said.

At the boy’s appearance in Manhattan Family Court on Friday, an NYPD detective testified that Davis had confessed to his involvement the attack on Majors and that the youth had described seeing “feathers come out of her jacket” as a result of the vicious slashing.

“He stated that he entered the park with two of his friends. The purpose of going into the park that day was to commit a robbery,’’ said Detective Vincent Signoretti, who helped interview Davis at the 26th Precinct station house.

“They followed a man . . . with the intention of robbing him.”

Law enforcement sources said the three boys — Davis and two 14-year-old classmates, all of whom attend PS 180 near the park — got spooked by something and ended up not mugging the man, instead turning their sights on Majors.

Davis recalled that one of his pals “dropped a knife” before the trio pounced on Majors, Signoretti said.

“Mr. Davis picked [the knife] up and handed it back to [his friend], and then Mr. Davis watched his friends grab the victim, put her in a chokehold and remove items from her pocket,” the detective said.

The boys swiped Majors’ bag, and one snarled, “Give me the phone!” a source said.

Police later recovered Majors’ phone nearby and used it to identify her, according to sources.

Davis then “saw the victim get stabbed,” Signoretti said. “He saw feathers come out of her jacket, and then all three of them ran out of the park . . . and they went home.”

Majors futilely tried to fight off her ­attackers, the detective said.

Davis said one of his friends told him “that Tessa Majors bit him on the finger,” Signoretti said.

Majors was rushed to Mount Sinai St. Luke’s Hospital, where she died of stab wounds to her face, neck and under her armpit, sources said.

Davis said the boys had pulled off another robbery days earlier, according to ­Signoretti.

The 5-foot-5, 110-pound boy gave detectives two first names for his accomplices, and one of the 14-year-olds was taken into custody on Friday, sources said. The other 14-year-old was still at large, sources said.

Sources said Davis was interviewed at the station house in the presence of his legal guardian and uncle, Roosevelt Davis, who also was in court with him, as was an aunt.

The boy’s mother died in 2016, according to neighbors.

Davis, who lives a few blocks from the crime scene around West 116th Street and Morningside Drive, bit his bottom lip and looked on nervously before his appearance in court, where he was dressed in a navy-blue sweatshirt, black sweatpants and black and white Air Jordan sneakers.

He was charged with murder and ­ordered held without bail.

Asked by a court officer if he swore to tell the truth during the hearing, the boy replied, “I swear.’’

The officer asked him to repeat it, saying he couldn’t hear him.

“I swear,” the boy repeated more loudly.

“My name is Zyairr Davis, and I’m 13.”

Surveillance footage shows the trio entering the park, but there is not footage of the slaying, Signoretti said. The video helped cops nail Davis, sources said.

Police canvassing the area after Majors’ death spotted Davis in the lobby of a building near the scene, noticing that his clothing was the same as one of the suspect’s in the video, sources said.

They picked him up for loitering, found a knife on him and brought him in for questioning, where he allegedly confessed, sources said. It was unclear whether the knife was the murder weapon.

Sources said Davis did not appear to have any prior arrests.

A neighbor of Davis’ said he was stunned by the teen’s arrest.

“I knew his mom before she passed,’’ said Raymond Sears, 46, adding that the boy had been close with his mother.

“He’s just a normal person,” said Sears, a food-service worker. “Any time I come by, I’m like, ‘Yo, what’s going on, Shorty?’ ”

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

“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.”

Brett Holtz, a junior psychology major at nearby Columbia University, called Majors’ murder “really sad.”

“This is finals time, holidays, when people are about to be with their families. [One of the suspects] is 13. It’s nothing you expect,” he said.

Paulina Pinsky, 27, a writer who went to Barnard as an undergrad and 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.”

But, Pinsky added, “my sympathy lies with the girl who died.”

“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.”

Additional reporting by Joe Marino and Julia Marsh