In a shocking case of twisted misconduct, a 41-year-old Bronx public-school teacher doted romantically on a fifth-grader — calling the 11-year-old her “boyfriend,” records show.

“As long as without sex, I think its(sic) legal,” teacher Yi Chen Cheng told a friend on Facebook, investigators found.

A Department of Education teacher for 16 years, Cheng taught music at PS 1 Courtlandt, a pre-K to 5th grade school in Mott Haven.

According to investigative reports and disciplinary records, Cheng sent the fifth-grader messages adorned with heart emojis, told him often, “I love you,” and expressed jealousy of his girlfriends.

With a phone she bought for him, they exchanged 563 texts and engaged in video chats at odd hours, chatting about kid stuff like basketball, going to the mall, and dating.

Cheng is one of two teachers recently fired after disturbing Facebook messages and texts came to light, reports by the city’s Special Commissioner of Investigation reveal.

In the other case, Dennis Colon, 46, a teacher at Mott Haven Village Preparatory HS in the Bronx, texted a student while driving in June 2017: “I f–king WISH you were my girlllllllllll,” the SCI reports.

Colon quickly texted other sheepish remarks, including, “Ugh should I have shut the f- -k up???” Moments later he texted: “Just got into an accident,” and sent a photo of his wrecked mini-van. “Waiting for a f–king Uber right now.”

The girl turned in screenshots. Records over three months showed 680 texts from Colon to her phone, and 350 from her to him. Confronted with his vulgar words, Colon claimed he was “drunk” at the time, quickly realized “it was a mistake,” and apologized. The DOE fired him.

In Cheng’s case, the boy told probers that his teacher never engaged in sexual behavior with him. The NYPD and Bronx District Attorney’s Office did not file criminal charges.

But a disciplinary hearing officer, Timothy Taylor, terminated Cheng, calling her conduct “particularly shocking.”

Records show her estranged husband, who shared a Facebook password, was stunned to discover a trove of notes between Cheng and the pre-teen boy.

“Don’t use me as a bargaining chip for your gf [girlfriend],” Cheng allegedly wrote in June 2017. “This is the second time that you are telling everyone what I told you. Do you think it’s a joke. Or you think I am a joke? You hurt me again. And this is what you should tell everyone from now, including your gf: I don’t love you, I don’t. Goodnight.”

The student replied, “Woow first I ain’t tell anybody about u. …”

Cheng then added, “I feel you are using me to get her jealous. And that hurts because you care about her feelings more than my feeling. And don’t you know how much I love you through everything?”

Cheng, who has a 5-year-old son, sent a photo of the student to a Facebook friend, calling him her “boyfriend,” reports state.

She confided she “fell for someone that [she] shouldn’t fall for. [M]aybe because we are meant to be … we know what each other wants without even saying a word … we don’t even fight. … I feel connected to him.”

Cheng, who did not testify or return a message from The Post, now works for the Piano School of NYC in Manhattan. She gives piano lessons in the homes of students under age 10 with a parent present, a spokeswoman said.