After several years of mega-mergers and takeovers, a large part of the corporate world is now headed in the opposite direction, selling unwanted parts of their businesses to raise cash and lose weight.

Part of this new trend is due to the nationwide hangover from the Bendix-Martin Marietta battle last year that embarrassed even the participants and has given a bad name to growth through acquisition.

But even more important is that the corporate balance sheet is in rotten condition and many businesses have been strapped for cash in a world of interest rates that remain high by historical standards. "Companies are in trouble and they need to raise money," says one leading investment banker.

"With the cost of working capital so high, there is an increased emphasis on return on investment as opposed to just growth," said another, Clarke Bailey, a vice president at Blyth Eastman Paine Webber Inc.

Numbers are hard to come by because many divestitures go unreported and unpublicized. But according to W. T. Grimm & Co., the Chicago merger watchers, the growth in recorded divestitures has been dramatic over the past two years. From a total of 666 in 1980, the divestiture count rose to 830 in 1981 and climbed to 875 last year, 37 percent of all merger and acquisition activity.

Even more pronounced has been the increase in internally generated acquisitions, when managers take over their own corporate units. Grimm researchers say those numbers are vastly understated, presumably because corporations rarely disclose buyers for subsidiaries of that scale. According to the Grimm numbers, nevertheless, reported management buyouts jumped from 47 in 1980 to 83 in 1981 and up to about 120 last year.

Wall Street is still abuzz about the recent Beatrice Foods Co. announcement that it is ending decades of expansion and instead has begun a massive effort to divest itself of 50 companies with total sales of about $900 million. Such bold retrenchment programs are rarely heralded, however, because many corporate managers are afraid publicity will make their company look more like a sinking ship than a streamlined yacht.

"Asset redeployment has become a bit of a watchword," said Maynard Toll, a First Boston Corp. vice president who is responsible for that firm's aggressive divestiture program. "Divestiture has a bit of the flavor of failure about it. But there is a difference in trying to sell something that is a dog and a kind of divestiture in which companies start selling good things."

First Boston officials like to cite a deal they helped engineer last year as an example of "positive" divestiture. That transaction, the $315 million sale of Entenmann's Inc. bakery by Warner-Lambert Co. to General Foods Corp., was designed to help the seller focus on medical technology, while strengthening the buyer's strategic commitment to the cake-and-cookie world. "That was a wonderful divestiture: big and desirable," Toll said.

"But I would say that the primary reason to get rid of businesses is that they are underperforming now or appear not to have good growth potential," Toll said. "Companies are likely to dress up the reason as being more a matter of redirection."

Some companies are still reeling from the go-go years of the conglomerate merger. One of the best examples of that problem is RCA Corp., where management has been trying for a year to sell off carpet, car rental and finance subsidiaries that do not fit into its efforts to return to communications, the company's basic business.

"The conglomerate merger has gone out of style and the divestiture trend is a throw-off of the days when people were buying things here and there," said Nicholas Boglivi, a vice president at Citicorp in their merger and acquisition business.

According to several investment bankers, energy companies have been actively peddling their coal properties for some time, fallout from the late '70s when the nation's energy future was said to rest with its coal reserves. Many firms hopped on that bandwagon only to find that coal ownership was not what it was cracked up to be.

Perhaps above all, the great sell-off is a sign of hard times. "Most companies are deciding they're not able to manage in or are not expert in all fields," said John Guttfreund, chairman of Salomon Brothers Inc.

"This period of poor business has been more difficult than most. It's like a system that's getting older. The third, fourth or fifth time you catch something, your resistence is less. You're not going to come back as strong. People are trying very hard to make sure they can come back as strong."

Guttfreund, however, thinks the hard lessons from ill-conceived mergers have not really sunk in. "I think you'll see the same patterns that we've had in the past," he said. "As the market goes up again, you'll find that companies are not doing what they ought to be doing--deciding what businesses make sense."