In the largest layoff in its history, American Telephone & Telegraph Co. yesterday announced that it will eliminate roughly 24,000 employes -- one out of five jobs -- from its Information Systems computer and telecommunications equipment work force.

The layoffs are part of an effort to boost profitability by cutting costs rather than a reflection of any weakness in its basic business, said officials of AT&T Information Systems, a $10 billion business based in Morristown, N.J. The layoffs at the 117,000-person division of AT&T had been expected for weeks.

"The bottom-line reason is to improve our margins," said Robert E. Allen, chairman of AT&T Information Systems. "It's an across-the-board cut that resulted from a wholesale look at our staffing." But he added that "we're doing better in this soft computer market than most people and our competitors expected."

The company said that 7,400 employes have received layoff notices already and more than 18,000 will be off the payroll by the end of the year. Another 6,000 workers will be released early next year.

Allen said an April Federal Communications Commission ruling allowed the Information Systems group to consolidate its operations, giving the company the flexibility to make the cutbacks.

Communications Workers of America President Morton Bahr, in a statement, demanded "immediate negotiations over issues surrounding these massive job cutbacks" and maintained that the layoffs helped create "an almost insurmountable obstacle" to contract negotiations next year.

Bahr accused the AT&T unit of being "top heavy" with management and asserted that management had done "nothing approaching the equality of sacrifice in the company's cost-cutting struggle."

Allen dismissed Bahr's complaints, saying that management cutbacks accounted for roughly a third of the layoffs. He added that AT&T would try to relocate the laid-off workers either within AT&T itself or in one of the seven regional Bell operating companies that were spun off from the Bell System in January 1984. However, he declined to say how many workers the company could place.

"Actually, it surprised me that it took them as long as they did for the layoffs," said Brad Peery, chairman of San Francisco-based Hicks and Peery, a telecommunications research firm. "Clearly, there are cost pressures at AT&T Information Systems that needed to be addressed. My guess is that it's the first round of layoffs. It wouldn't surprise me if they laid off that number of people next year."

Peery also agreed with Allen's assessment that the layoffs were motivated by cost cutting. "I certainly don't think they're hurting as much as the rest of the industry," he said.

The size of the layoffs underscores the new competitive environment that AT&T has operated in since the Bell system was broken up as part of an antitrust consent decree last year.

Until that time, AT&T had been one of the most secure places to work in the country. These layoffs -- which follow the layoff of nearly 2,000 manufacturing employes at a Shreveport, La., telephone plant -- highlight AT&T management's public claims that it has become a bottom-line-oriented competitor.

The company said the costs associated with the cutbacks would have no material effect on AT&T's 1985 earnings. Company spokesmen estimated AT&T would save "hundreds of millions of dollars" a year as a result of the cuts.

AT&T stock closed at 21 7/8 yesterday, up 1/2 in active trading.