The youth basketball coach at the center of Michael Avenatti’s Nike bribery case testified Thursday that he felt “totally betrayed” that the lawyer allegedly tried to extort the sportswear giant — while Avenatti’s former office manager said her boss considered the plan a “light at the end of the tunnel” amid financial woes.

“I trusted him as my lawyer,” said California Supreme basketball coach Gary Franklin, Avenatti’s client during the alleged March 2019 attempt to shake down Nike for more than $20 million. “This is not how I wanted things handled.”

Franklin told the court that Avenatti never mentioned plans to expose the shoe company at a press conference.

“I didn’t want to make it public because I didn’t want to hurt Nike, I didn’t want to hurt any of the kids or the parents, I didn’t want to hurt my reputation or my program’s reputation.”

The basketball coach said he never suspected Avenatti — and refused to speak to him after his arrest.

“I was upset with him,” the coach said. “I thought he’d misrepresented me and betrayed me, and I didn’t want anything to do with him.”

Prosecutors claim Avenatti took advantage of allegations brought by Franklin in order to shake down the company — and all while he was more than $15 million in the hole for personal and business debts.

Paralegal Judy Regnier took the stand eariler in the day to describe the office’s bleak financials in the months leading up to Avenatti’s alleged extortion.

“There wasn’t enough income at that time to cover all the payrolls, and we were trying to keep the firm running,” she said, explaining that Avenatti was “micromanaging” and required daily updates on the bank balances.

Cash flow was so dire that the firm had been evicted from its offices because it “didn’t have the funds available to pay rent,” the onetime office manager testified.

“We didn’t have sufficient funds to pay the bills,” said Regnier, who says she was warned to keep quiet about it. “I had direct instructions from Michael not to discuss the financials with anyone else.”

Yet in March 2019, Avenatti’s demeanor suddenly brightened and he talked of a plan to “clear the debt.”

“It was like he saw the light at the end of the tunnel,” Regnier said of her boss of 11 years.

“He said that we could start a new firm,” she testified, recalling statements that “he would be able to live his life as he wanted to live it.”

In a recording made by a Nike lawyer, Avenatti can be heard saying he’ll take “$10 billion” off Nike’s market cap by airing the corruption allegations — unless they agree to fork over more than $20 million.

Avenatti has pleaded not guilty, and says he was aggressively negotiating a settlement for his client.