SAN FRANCISCO — A federal judge has approved a $22.5 million fine to penalize Google for an alleged privacy breach, rejecting a consumer rights group’s plea for tougher punishment.

The blessing from US District Judge Susan Illston came late Friday. She made her ruling a few hours after a hearing in San Francisco for final arguments about a fine that is the cornerstone of a settlement reached three months ago between the Federal Trade Commission and Google Inc.

The rebuke revolves around allegations that Google duped millions of Web surfers using the Safari browser into believing their online activities could not be tracked by the company as long as they did not change the browser’s privacy settings. That assurance was posted on Google’s website earlier this year, even as the Internet search leader was inserting computer coding that bypassed Safari’s automatic settings and enabled the company to peer into the online lives of the browser’s users.

The FTC concluded that the contradiction between Google’s stealth tracking and its privacy assurances to Safari users violated a vow the company made in another settlement with the agency last year. Google had promised not to mislead people about its privacy practices.

While the FTC hailed its actions as proof of its resolve to protect the public interest, a consumer rights group attacked the settlement as an example of ineffectual regulation. The group, Consumer Watchdog, is trying to bring more attention to the issue as the FTC wraps up a separate investigation into complaints that Google has been stifling competition and raising online ad prices to highlight its own services in its influential search engine.

Illston, though, found that the fine and other facets of the settlement were all ‘‘fair, adequate, and reasonable.’’

‘‘We’re glad the court agreed there was no merit to this challenge,’’ Google said in a statement.

Consumer Watchdog attorney Gary Reback said he is hoping to pressure the FTC to take Google to court in the antitrust investigation instead of negotiating consent decrees and other types of settlements, as it did in the Safari privacy flap.

A consent decree ‘‘is not a good way to police Google,’’ Reback said in an interview after Friday’s court hearing. Reback also is representing some of the Internet companies that have filed complaints against Google in the antitrust case.

FTC chairman Jon Leibowitz has said he expects regulators to decide whether to sue, settle, or simply close the antitrust investigation by the end of this year.

In the Safari case, Consumer Watchdog argued that the fine amounts to loose change for a company like Google. Reback asserted Google should be fined at least $3 billion.