The San Francisco city attorney’s office agreed to pay nearly $5 million to a motorcyclist who was badly injured in 2013 when he was struck by a fire truck driven by a city firefighter suspected of being drunk on the job, officials said Tuesday.

The motorcyclist, 53-year-old Jack Frazier, sued the city on Oct. 28, 2013 — four months after a 32-ton ladder truck plowed into him at Fifth and Howard streets and the firefighter behind the wheel was arrested on suspicion of being intoxicated.

“We think this is a fair agreement to resolve the case and avoid further costs and risks of litigation,” said Andrea Guzman, a spokeswoman for City Attorney Dennis Herrera.

The $4,990,000 settlement will go through the Board of Supervisors’ Government Audit and Oversight Committee before the full board votes on whether to accept it.

The firefighter, Michael Sean Quinn, now 45, was arrested on suspicion of drunken-driving-related charges after he allegedly slammed into Frazier on June 29, 2013.

A San Francisco Superior Court judge, though, all but doomed the prosecution’s case when she tossed out key evidence, saying police bungled the investigation.

Frazier was tossed off his motorcycle when he was hit and slammed into a fire hydrant, causing injuries to his ribs, hip and ankle.

Quinn left the scene half an hour after the 11:35 p.m. crash, and, according to sources, was captured on a surveillance video guzzling water at the Chieftainbar nearby before returning to the station some two hours later.

He then failed two Breathalyzer tests administered by the Fire Department, but police investigators neglected to do a blood test until after 6 a.m., when Quinn’s blood alcohol content was 0.11 percent — still above the legal limit of 0.08.

Prosecutors estimated that Quinn’s blood alcohol at the time of the crash was likely around 0.31 percent.

The driver’s actions “were despicable with a willful conscious disregard of the rights and safety of others,” Frazier’s attorney, James Romag, wrote in the 2013 court filing.

Quinn, who resigned from the department shortly after the crash, was indicted in March 2014 on three drunken-driving-related counts, but one year later, San Francisco Superior Court Judge Kay Tsenin threw out the Breathalyzer evidence. She said the two tests were unreliable because the Fire Department had not maintained and calibrated the equipment.

Prosecutors, nonetheless, have gone forward with charges, hoping to show Quinn was intoxicated without the Breathalyzer evidence.

Evan Sernoffsky is a San Francisco Chronicle staff writer. Email: esernoffsky@sfchronicle.com Twitter: @EvanSernoffsky