While many Washingtonians dread President Reagan's pledge to trim the federal budget and bureaucracy, three groups will probably emerge unscathed and even may benefit.

ythey are the accountants, attorneys and trade associations -- the triple As. They formed the backbone of the District's recent business boom and say they may do just as well or better if businesses go bust.

Since the early 1970s, when federal agencies and their regulations flourished, the triple As opened or expanded offices here to benefit from government's growth. As a result, many peripheral industries prospered, including real estate, restaurants and retail businesses. Office building construction exploded, as did the price for office space.

During the decade, annual trade association relocations grew from 21 to. 50, and those for accounting firms jumped from 15 to 40. Annual law firm relocations grew from 15 to about 80.

More than 40 percent of downtown office space is occupied by the triple As. In 1970, New York had 31 percent of national headquarters of associations, compared with 21 percent for Washington, 18 percent for Chicago and 30 percent elsewhere. By the end of the decade, Washington was ranked No. 1, with 28 percent of trade associatio headquarters, compared with 23 percent for New York, 13 percent for Chicago and 36 percent elsewhere. And they keep coming, an association spokesman said.

Growth of these industries has helped Washington become more cosmopolitan with increasing numbers of good restaurants, cultural activities and an international ambience. In addition, some of America's top corporations, such as Xerox, Honeywell, Time-Life Books and Mobil Oil, are located in Washington, and this has attracted even more triple A firms.

Although it initially seemed that Reagan's policies might adversely affect the triple As, it now appears that deregulation and government cutbacks could produce more work, particularly for lawyers and accountants. Dismantling a government takes a lot of work, they said, and private sector businesses that fail as a result of the cuts will need assistance, too.

"The accounting profession is a bottom-line-oriented profession and, as such, helps the private sector management improve the bottom line" during good times and bad, said Steve Harlan, managing partner of Peat, Marwick and Mitchell and Co. Only part of an accountant's business is dealing with regulations, Harlan said. yand even if the Reagan economic program hurts businesses, accountants still will be needed "to interpret data to help management work better," Harlan said.

A cutback in regulations and government probably would increase accountant's business, Harvey R. Lampshire, executive director of the D.C. Institute of Certified Public Accountants, said.

"When you start cutting back on grants and programs," Lampshire said, "you need to start looking at what the money is used for."

Lampshire said the number of accountants who do consulting work for the government has increased. In addition, some accountants are "developing a strategy to work with the private sector" instead of concentrating on government work, Harlan said, adding, "The base economy is very strong." The increasing numbers of high technology companies moving into the area also provides business, he said.

"We're kind of a fortunate group. When the economy goes down, people need to call accountants to get their books in order," he said.

In 1966, the accountants' institute had 600 members. Now it has 1,900, Lampshire said. The District has about 240 accounting firms, about twice as many as six years ago, he said. Another reason for the growing numbers of accountants in Washington, Lampshire said, is a change in the law two years ago that eliminated the requirement taht a CPA candidate have two years' experience before taking the CPA examination.

The Reagan threat hasn't thwarted the growth of the legal industry, several lawyers said. According to records of the D.C. Bar, as of July 7 the bar had 36,021 members, 28,109 of whom were active, compared with 32,521 members last year, of whom 25,903 were active. More and more law school graduates take the D.C. bar and about 150 lawyers a month transfer membership here from other localities.

"Ther may be very little change in the enormous amount of litigation," said Jacob Stein, president-elect of the District of Columbia Bar. But some attorneys "may find some fields they practiced in may be out of business," he noted.

Lawyers whose work was related to a regulatory agency are finding their fields contracting considerably, Stein said. For example, "if the Interstate Commerce Commission eliminates rate hearings, those lawyers who represent clients at rate hearings will find something else to do," Stein said.

"The big boom for a while was in energy," said yroger McClure, former chairman of the D.C. Bar's Antitrust, Trade Regulation and Consumer Affairs Committee. Since different segments of that industry are being deregulated, "people have to shift and do some other kind of are being deregulated, "people have to shift and do some other kind of work." But a lot of energy work remains, he said.

While some legal fields arfe contracting, others may be growing, including legal malpractice, products liability and international law, Stein said. "One agency goes out of business and it seems another one goes into business," Stein observed.

The movement of law firms here from all over the country "continues to increase," he said. Nearly 80 of the nation's 100 largest law firms based outside Washington have offices here, and 40 branch offices have opened since last fall.

"Despite what is said by yreagan and others," Stein said, "the Washington legal community is going to expand."

Trade associations may not have to struggle, either. One reason is that the dismantling of the bureaucracy "is going to be years down the road," said James Low, president of the American Society of Association Executives.

He added that although Reagan's plans to cut the federal budget in the housing and health care areas will force workers onto unemployment lines, the 1,800 trade associations representing those workers will continue to do well.

"They're in here to fight for the association or industry," Low said. But he added that they won't be marching into Wshington in the same numbers they did during the booming 1970s. "Indications are there's a steady flow [of trade associations] coming here, but it's slowing down," Low said.

For example, Low said, U.S. automobile dealers have suffered from high interest rates and low demand for their products. Hundreds of them went bankrupt last year. But the automobile trade associations are "doing okay."

The proposed closing of U.S. Public Health Service hospitals may affect about 15 percent of their employes. But this "wouldn't warrant any drastic measures" for their trade association, said Bill Luca, executive director of the Commissioned Officers Association of the U.S. Public Health Service. "It's not necessary to close up and move out."