Mayor Bloomberg was a hero for helping nab an extortionist computer hacker, a prosecutor said yesterday – but a defense lawyer claimed the mayor was rash in seeking the helpful hacker’s arrest.

Oleg Zezov, 26, is charged with trying to extort $200,000 from Bloomberg after sending him an e-mail in March 2000 saying he’d broken into the computer network of Bloomberg LP, the mayor’s global media company.

Within weeks of that initial e-mail, Zezov demanded the money be wired to an offshore bank account – and in return, he would agree not to publicize secrets he’d gleaned about the company, Assistant U.S. Attorney Robert Strang told a jury in Manhattan federal court.

Bloomberg decided “he was not going to pay off an extortionist, not cave in to his demands,” Strang said.

But defense lawyer Robert Baum said Bloomberg misunderstood Zezov’s offer.

“He said, ‘I will give you information about these gaps, and if you’re not satisfied, you don’t have to pay,’ ” Baum said.

“This was a rush to judgment by a multibillionaire who could not admit there were bugs in his system.”

Zezov, of Almaty, Kazakhstan, worked for a company that was trying out Bloomberg’s computer news and data service.

Prosecutors say Zezov tricked Bloomberg’s computer system into thinking he had logged on even though he had not – and then roamed freely through it.

He saw his use of the system as an entrepreneurial opportunity, Baum said, and “it’s not a mistake to be asked to be paid for your services.”

Bloomberg saw otherwise, and called the FBI.

With agents’ help, Bloomberg eventually got Zezov to agree to travel from Kazakhstan to a meeting in London.

Their meeting in a hotel room was secretly videotaped – and prosecutors promise to show that tape to the jury.

The incident unfolded the year before Bloomberg ran for mayor. He is expected to testify next week.