A struggling actor who became a cooperator against a bicoastal cocaine ring he once worked for testified Tuesday that he thought his high school pal was involved in the Midtown murder of a law student who moonlighted as a drug mule.

“When I heard Brandon was dead I was immediately afraid because I knew McKenzie had something to do with it,” Quran Pender told jurors in Manhattan Supreme Court of the 2012 execution-style hit on Brandon Woodard.

The Cornell University graduate, who starred in the 2004 Queen Latifah film “The Cookout,” agreed to flip on his high school pal, Lloyd Mckenzie, 39, in exchange for a five-year prison sentence, which he has already served.

Pender, 38, said that he became friends with Woodard after moving from New York to Los Angeles.

“He was pretty big on the night scene, and he was a pretty cool guy and could get me into a lot of the parties,” said Pender, wearing a preppy blue sweater, as about two dozen of the defendants’ friends glared at him from the gallery.

He said that Woodard, 31, was living a glamorous life, hanging out in the VIP sections of exclusive clubs, driving a brand new Range Rover and living in a luxury townhouse in tony Marina Del Rey.

The University of West Los Angeles Law School student was paying for it all by selling cocaine and was looking to find more buyers.

“He mentioned he needed help selling cocaine or white as he referred to it,” said Pender, who introduced him to McKenzie. The three struck a deal. Woodard, 31, and his cohorts would ship the blow to various addresses in Queens.

He would then fly to New York to collect payment, and Pender would get a cut.

A few months later, Woodard was shot dead Dec. 10, 2012, in broad daylight in front of a boy’s boarding school on West 58th Street.

He was on his way to collect $161,000 from McKenzie — and Pender had unknowingly arranged the fateful meeting via his phone from Los Angeles.

Pender, who was working as a middle school teacher at Pacific Hills School, said he had coordinated the cash drop while teaching an American history class.

The shooter, who fired one bullet into the back of Woodard’s head, was never caught. But prosecutors say McKenzie was the getaway driver who orchestrated the killing to get out of paying his debt.

On the day of the shooting, McKenzie told Pender he had met Woodard and made a partial payment then pressured him to fly to New York. “I had a text message from McKenzie saying you need to come to New York, it doesn’t matter what the cost is, I got an envelope,” said Pender.

About an hour later he learned of Woodard’s death, he said.

McKenzie is on trial with four others — Lature Irvin Sr., Pedro Doloille, Michael Wisdom and Darryl Mason — who are not charged with murder but face serious drug raps.

Pender, who grew up in a housing project in Jamaica, Queens, admitted that he lived a life of crime — even while a student at Cornell.

He and some pals stole from the school and other students on campus.

Pender also sold marijuana throughout college and continued the illicit trade after he was hired by UBS bank and JP Morgan Chase. When he moved to Los Angeles, he began selling weed by the pound — even while working as a teacher at Pacific Hills School in West Hollywood, he said.

Pender’s movie roles weren’t profitable, he said. He only got about $10,000 for starring in the comedy “The Cookout” opposite rapper-turned-actress Eve. He got about the same for the 2011 sequel “The Cookout II.”​