San Francisco Planning Commissioner Dennis Richards, who has made a name for himself as a watchdog of building code scofflaws and a crusader against of gentrifying speculators, finds himself in an uncomfortable position these days.

He is facing allegations that an investment group he’s a member of is guilty of what he publicly rails against: ignoring city planning and building codes to make millions of dollars on a quick real estate flip.

Richards says that the violations were relatively minor and that he is being targeted because of his frequent criticism of the Department of Building Inspection.

The fight, which has been simmering since September, flared up Wednesday night during a public hearing on the property’s permits. Richards is part of a group of investors, Six Dogs LLC, that attempted to get the city’s Board of Appeals to overturn a decision to yank the permits for 3426-3432 22nd St., a four-unit historic Italianate building near Guerrero Street.

Six Dogs LLC, a partnership that includes Richards and Noe Valley real estate agent Rachel Swann, bought the 22nd Street property in June of 2017 for $2.7 million. The group spent $350,000 buying out four tenants and put the building through a “multi-million dollar renovation,” which included remodeled interiors, new bathrooms and kitchens, windows and siding, roof and decks. Six Dogs is now marketing it as “a trophy collection of residences” for $7.88 million.

While Richards regularly rails against speculators and property-flippers, who drive out long-term tenants through evictions or lucrative buyouts, he scoffed at the notion that he was engaged in a similar practice. He said all the tenants requested to be bought out and that he had hoped the tenants paying the lowest rent — a family of Mexican immigrants paying less than $600 a month — would stay, but they wanted to relocate.

“Nothing had been done to the building in decades,” he said. “It was slum conditions. People can throw rocks at me if they like, but I go to bed knowing that everyone won here.”

The project was going as planned until September when city building inspectors revoked nine permits on the building on the same day they issued notices of violations on the property. While builders generally have 30 days to come up with a plan to correct violations before permits are revoked, in this case the notice of violation and the permit revocation both happened Sept. 30. Only one or two permits a year are ever revoked.

Richards and his supporters said the decision to revoke the permits so quickly shows that the building department has a personal vendetta against him. Richards said that officials started attacking him after a contentious May 9 Planning Commission hearing at which he blasted the department for allowing unpermitted work on an 18th Street building.

Richards said building inspectors were “trying to get back at me” and accused the inspectors of “out of control criminal activity.”

“It will be investigated,” Richards said at the Board of Appeals meeting. “I look to you to help my plight, my financial safety and to protect me from this Trumpism that has been a cancer on this city going on for decades and nothing has been done about it.”

The news website Mission Local was the first to report on the case.

Senior Building Inspector Joseph Duffy said that the revocation was necessary because Six Dogs didn’t cooperate when asked to consolidate the nine permits into a single permit displaying the full scope of work.

“We wanted a full set of drawings and Mr. Richards pushed back and didn’t cooperate,” said Duffy.

Another city official, Zoning Administrator Scott Sanchez, said that the 22nd Street violations are serious and need to be corrected. This includes 14 windows installed in the rear of the building that don’t conform to historic standards. Also, the investment group needs permission for four skylights that were added to the roof without permits, Sanchez said. Six Dogs must remove six parking spaces from the building’s garage. Marketing materials tout the property’s 12 parking spaces, but the city allows only six spots in the building.

“There are clear violations here of the planning code and the building code and other issues,” said Sanchez.

Richards called the city’s complaints “the biggest crock I’ve ever heard.”

He said that the issues were minor and said that he had left the details to the contractor and project engineer Patrick Buscovich. At the same time, he acknowledged that he was ultimately responsible as the property owner.

“I hold project sponsors responsible for the actions of their contractors, so I can’t stand here and say, ‘This is Pat’s fault,’ he said. “We hired him. Was it sloppy? Did we hire someone who was sloppy? Maybe. But as screwed-up projects go, this is not a 10 on a scale of 1 to 10. It might be a 3 or a 4, but it’s not a 10.”

The Board of Appeals ultimately decided to continue the matter to a future hearing, and Rick Swig, the board president, urged the two sides to come together and resolve the dispute.

“What we have here is a sloppy mess,” said Swig.

During public comment, a half dozen residents, all longtime critics of the building department, supported Richards.

Jerry Dratler said the rules are “not consistently enforced,” pointing to the case of 49 Hopkins in Twin Peaks, where a home designed by famed architect Richard Neutra was demolished without a permit. In that case, the permit was not revoked.

Noe Valley resident Ozzie Rohm said that the building department regularly lets developers and investors get away with illegal demolitions and unapproved additions that are “far more egregious” than Six Dogs’ alleged violations.

“It’s hard for the public when the rules are not consistent,” said Rohm.

J.K. Dineen is a San Francisco Chronicle staff writer. Email: jdineen@sfchronicle.com Twitter: @sfjkdineen