Buoyed by six weeks of rising prices on Wall Street, the stocks of 39 Washington-area companies climbed to new 52-week highs last week.

Traders, analysts and company officials attributed the rapid rise in stock prices to the general trend of the market, the favorable economic climate in the Washington region and individual company performances.

The new highs were set by a diverse group of companies that included Marriott Corp., Martin Marietta Corp., Comsat, Media General, BDM International, Ryland Group, Federal Realty, Potomac Electric Power Co. and Bank of Virginia.

The new highs of last week were part of a recent pattern that has seen two dozen other area companies posting new 52-week records during January and February. In one case, Hechinger Co. class B stock set new highs six weeks in a row. Last week, Hechinger class A stock set its own new high. Many of the new highs marked since Jan. 4 were also the highest prices at which the stocks have sold in five years.

Several Washington-area banks and savings and loan institutions have seen their stocks rise dramatically during the past several months in response to falling interest rates, which lower the lending institutions' cost of money.

Major local gainers on the New York Stock Exchange since Jan. 4 included Legg Mason, (up 48.8 percent), Circuit City (up 39.3 percent), Ryland Group (up 25.1 percent), U.S. Air (up 12.1 percent). American Stock Exchange movers included BDM International (up 36.3 percent) and Media General (up 20.9 percent).

Over-the-counter stocks showing strong gains since Jan. 4 included International Bank of Washington (up 75.3 percent), General Physics (up 40 percent), MIW Investors (up 45 percent) and Rouse Co. (up 29.9 percent).

While several company executives said the prices of their stocks were helped by the recent bull markets, they cited individual situations as primarily responsible for the higher prices.

At Avemco Corp., a national aviation insurance and finance services organization based in Frederick, Md., Treasurer John R. Yuska attributed his stock's rise from $19 on Jan. 4 to $23.125 last week to a recently released earnings statement showing Avemco earned a record $5.9 million ($1.97 a share) for 1984, compared with $4.1 million ($1.50 a share) for the previous year.

At the Ryland Group headquarters in Columbia, President Charles E. Peck said the rise in his company stock from $21.375 on Jan. 4 to $26.75 last week, was based on a belief by brokerage house analysts and institutional investors that lower interest rates would improve the climate for selling houses. "They think our company will perform well, and they're buying our stock," he said.

They were buying, he noted, in the face of a recent annual report that showed Ryland earnings per share off 40 percent. Ryland reported 1984 revenue of $404 million ($1.52 a share), compared with $394 million ($2.52 a share) for 1983. Peck said the earnings-per-share drop reflected a sharp decline in business in the Houston area, where the oil-based economy had suffered and, in turn, hurt the home-building business.

Patrick C. Ryan, chief trader at Johnson, Lemon & Co., said it appeared that the January-February surge was heavily financed by institutional investors expressing interest in companies with strong projected earnings for 1986 and 1987.

Washington-area companies, he said, were attracting investor interest because of this region's relatively stable economy, "quality managements" and general reputations for safety. "Of all the area stocks I've traded over 24 years, very few have killed the investor or wiped him out. There was Geico, which looked bad for a while, but came back to be the big success," Ryan said.

Small investors, who as a group have been out of the market for some time, were beginning to return, but warily, Ryan said. "They're starting to come back but they're not beating the doors down," he noted. A more significant feature of the current market, he said, is that stock brokers, who have been more interested in investments such as tax shelters, once again are trading for their own accounts.

The strength of key Washington-area issues, said Charles T. Akre Jr., director of research at Johnston, Lemon, was demonstrated by the 1984 results of the Johnston, Lemon 30-stock index of local companies that outperformed the Standard & Poor's 500 by more than 3 to 1. Fifteen of the 30 companies were on last week's list of new highs.

Eliot H. Benson, vice president and research director at Ferris & Co. Inc., said stock prices had been helped by "improved evaluations of the earning prospects of a lot of local situations," and that investors were finding "special values" in companies that had been "somewhat neglected." Giant Food Inc., which set a new high of $30 in late December, and Hechinger, were among the companies he mentioned as attracting investor interest.