The recession continued to worsen in the first quarter as the nation's output of goods and services fell at a 3.9 percent annual rate after adjustment for inflation, the Commerce Department reported yesterday.

The seasonally adjusted drop in gross national product was the third in the last four quarters. It came on the heels of a 4.5 percent rate of decline in the final three months of last year, and it left real output virtually no higher than it was three years ago.

Inflation also fell sharply, the department said. The GNP implicit price deflator, the broadest measure of prices available, rose at only a 3.6 percent annual rate, down sharply from a 9.5 percent rate in the fourth quarter of last year.

Most economic forecasters expect a smaller economic decline this quarter before a 10 percent cut in personal income taxes July 1 triggers a recovery led by consumer spending. The strength and duration of any recovery is uncertain, however.

"At present, the economy is marking time," Murray L. Weidenbaum, chairman of President Reagan's Council of Economic Advisers, told reporters. Getting it growing again at a healthy, sustainable clip will require an agreement between Reagan and Congress on a compromise to lower future federal budget deficits, he said.

Without a compromise to get the 1983 deficit below $100 billion, interest rates could remain high and the recovery weak, Weidenbaum said.

"The makings of a compromise are possible, so that no one could claim a great victory and no one could claim a great defeat and the public interest be served," he said. "I'm upbeat . . . . But will strong-willed people get together? I really don't feel confident enough of my knowledge to say."

Even if Congress adopted all $56 billion worth of spending cuts and tax increases that President Reagan proposed in February, it would still leave the deficit too high next year, Weidenbaum added. In the negotiations with congressional leaders, administration officials are assuming a 1983 deficit of about $180 billion if no spending cuts or tax increases are passed. That figure is based on a recovery substantially weaker than the one forecast by the administration only two months ago.

Weidenbaum also said that inclusion of a 4 percent surcharge on tax bills of upper-income taxpayers "doesn't violate the president's program" of tax cuts.

"No one is enthusiastic about every part of a compromise, otherwise it is not a compromise," he said. "The notion of a temporary surcharge to deal with a temporary budget problem to keep in place a permanent tax cut does not do violence" to the program.

Most of the first-quarter decline in GNP showed up as a $40 billion drop in business inventories, the largest in history. In real terms, spending on business investment, housing, and state and local government purchases also fell, as did net exports. Consumer spending and federal government purchases rose.

Housing investment, which has been hit particularly hard by high interest rates, slumped to its lowest level since the spring of 1967.

The drop in inventories was so great that, if business simply begins to reduce them more slowly, the change would have a significant economic impact. A slower rate of inventory reduction, in fact, might stabilize the overall economic picture if consumer spending continues to increase.

Most economists expect further declines in business investment in new plants and equipment, in net exports, and in state and local government outlays.

Commerce Secretary Malcolm Baldrige said he thinks inventory liquidation will run its course in another month or two and the economy will then turn up.

Some other observers, including Jerry J. Jasinowski, chief economist of the National Association of Manufacturers, were less sanguine.

"The economy is a mess and will continue to be weak until we get a bipartisan budget compromise that reduces federal deficits," Jasinowski declared. "This should send the financial markets the necessary signal to reduce interest rates, spur investment, and get the recovery under way. Under present policies, we would expect real GNP to decline at an annual rate of about 2 percent during the second quarter of the year, and we don't expect the recovery to get under way until summer."

At a Joint Economic Committee hearing on Capitol Hill, economist Lawrence Chimerine of Chase Econometrics said "recent data suggest that the worst may be over, although a sharp rebound does not appear in sight as of now."

He predicted that the economy would be flat overall in the second quarter, but said that "flat" is not good enough. The lack of growth "would still leave the economy in serious condition, with several industries and regions in particular facing unprecedented problems," he warned.

Robert A. Gough, senior economist for Data Resources Inc., disagreed that the recession is over, but said there were "substantive reasons" to suggest that an upturn in the economy should begin in the summer months.

He also said any recovery depends "significantly on the willingness of the Federal Reserve" Board to loosen its monetary policies.