The mother of Zymere Perkins admitted in court Monday that she whipped her son with a belt years before her ex-boyfriend allegedly beat the 6-year-old to death in a Harlem apartment.

Geraldine Perkins, 29, was testifying at the murder trial of her ex-lover, Rysheim Smith, as part of a plea deal that could see her set free with a slap-on-the-wrist punishment, despite her own admitted role in Zymere’s 2016 death.

Perkins told jurors in Manhattan Supreme Court that she abused Zymere when he was 3 years old while she was living at a shelter for drug addicts.

“I would yell at him or I would beat him with a belt,” she said of Zymere.

“He’d cry,” she added.

Perkins has pleaded guilty to manslaughter and agreed to testify against her ex-boyfriend in exchange for a two- to six-year prison sentence. She’s already spent three years behind bars, for which she’ll get credit.

A counselor at the shelter witnessed the abuse and told Perkins if she did it again, she’d have to report her, the mom said.

“That was the last time until I met Rysheim,” she said of the beating.

Prosecutors say Smith, 45, starved and tortured the boy for months until his little body gave out on Sept. 26, 2016 — while Perkins stood by silently.

Perkins’ testimony in court on Monday was the first time she had laid eyes on Smith since the slaying.

She told jurors that she gave birth to Zymere shortly after graduating high school — but seven months later her grandmother kicked her out of her house.

“My grandmother accused me of beating my son,” she said.

The young mom said she briefly turned to prostitution before lying about a crack addiction to get into a drug shelter.

She first met Smith in May 2015, and he swept her off her feet, buying her flowers and gifts.

“It was wonderful,” Geraldine recalled. “He was a father figure for my child. He played with him. He cut his hair most of the time. He bought toys for him. He read the Bible to him.”

She and Zymere moved into Smith’s filthy Harlem apartment, where he was illegally squatting.

Prosecutors say Smith started terrorizing the boy. In addition to vicious beatings, Smith allegedly forced Zymere to take frigid showers and relieve himself in a bucket in the living room. An autopsy later revealed that the child had endured more than 30 rib fractures.

“I don’t know how to raise him,” Perkins said. “I didn’t know what I was doing.”

Her testimony is scheduled to continue Tuesday morning.