In a major victory for the Justice Department, the National Association of Broadcasters agreed yesterday to settle a major, three-year-old government lawsuit that accused the NAB of violating federal antitrust laws by issuing voluntary advertising guidelines that limited the number of commercials a television station could broadcast each hour.

In a proposed settlement submitted to U.S. District Court, the NAB agreed to drop the portion of its voluntary advertising code that sets time restrictions on commercials.

As a result, voluntary industrywide rules no longer will limit the number of minutes each TV station may devote to commercials, the number of promotions that can be broadcast consecutively within each commerical interruption or the number of products that can be promoted during a single commercial.

However, under the proposed settlement, individual stations or a chain of affiliated stations can adopt similar restrictions on their own.

The settlement, which must be approved by U.S. District Court Judge Harold H. Greene, represented a significant victory for the Justice Department because it achieves all the department sought when it filed its suit against the broadcasting industry's largest trade association in 1979.

The Justice Department has argued that the NAB's voluntary code--followed by about 70 percent of the broadcasting industry--limited the amount of commercial television time, thereby driving up advertising prices to the ultimate detriment of consumers.

The NAB had argued that the code was necesesary to protect the public from overcommercialization in television. However, the NAB's executive vice president and general manager, John Summers, said yesterday that the NAB agreed to the settlement to avoid lengthy and costly litigation in which the NAB might be found guilty.

NAB officials were clearly concerned about an earlier ruling by Greene who, without a trial, said that the rule restricting the number of products that could be promoted in a single commercial violated federal antitrust laws.

Not only did the NAB fear that this ruling would be extended to the rest of the code, but it also said it was concerned that Greene's initial ruling could be used by advertisers against the NAB in private lawsuits as proof that the NAB violated antitrust laws.

By agreeing to the settlement, the NAB hopes that the order will be declared moot by a U.S. Court of Appeals and then will not be considered as proof of antitrust violations.

After Greene's ruling last August, the NAB stopped enforcing all of its advertising code, including portions that bar stations from advertising liquor, birth-control devices and children's vitamins. It was unclear yesterday whether the association would restart its enforcement of those parts of the code after the settlement is approved.

However, local stations and the national networks said yesterday that they had no plans to increase the number of commercials as a result of the settlement. "There will be no effect at all on what viewers see," said M.S. Rukeyser Jr., executive vice president for NBC, who noted that the networks already run fewer commercials than permitted under the NAB's code.

"Most stations are going to continue with self-imposed restrictions because we feel overcommercialization can hurt our audience," added Thomas Cookerly, president and general manager for WJLA-TV Channel 7 here.

Nonetheless, the settlement is certain to draw opposition from a variety of groups concerned that it could lead not only to more commercials but also to ones of questionable taste. For that reason, Action for Children's Television said it would oppose the settlement.