Federal authorities are attempting to deport an American-born author and poet who has lived in Cuba and Nicaragua and frequently criticized the United States in her writings.

A number of prominent authors -- including Norman Mailer, William Styron, Kurt Vonnegut, Alice Walker and Arthur Miller -- joined Margaret J. Randall in a lawsuit yesterday aimed at blocking the proceedings against her. Randall is a University of New Mexico professor who relinquished her American citizenship in 1967 and is now a citizen of Mexico.

The Immigration and Naturalization Service, in denying permanent residency status for Randall, cited her criticism of the Vietnam war, the 1970 shootings of four students at Kent State University and her reference to law-enforcement authorities as "pigs" 14 years ago.

In a lawsuit filed in U.S. District Court here on Randall's behalf, the Center for Constitutional Rights charged that the INS is seeking to deport Randall for "ideological reasons" as part of a larger campaign to "chill the expression of aliens who lawfully reside here."

Mailer, Styron and the other writers contend that the INS action is denying them the right to associate with Randall. The INS gave Randall until Wednesday to leave the country voluntarily.

A number of prominent foreigners have been excluded from the United States in recent years under the 1952 McCarran-Walter Act. Colombian novelist and Nobel laureate Gabriel Garcia Marquez, Salvadoran leftist leader Ruben Zamora and three Nicaraguan officials are among those who have had problems obtaining U.S. visas.

Critics charge that the Reagan administration has increasingly used the law to stifle political dissent. The law allows INS officials to deny entry to communists and anarchists or those who advocate such doctrines.

The case of Randall, 48, the author of more than 40 books, is particularly unusual because she is a native New Yorker. Randall moved to Albuquerque early last year with her American husband to be near her elderly parents.

"I really believe that I have a right to be here with my family," said Randall, who has described herself as a Marxist. She said she was being excluded for saying "things that are contrary of the opinions of this administration. I don't expect everyone to agree with the points of view I've espoused, but I think I have a right to those points of view."

INS spokesman Duke Austin denied that any political crackdown is under way, saying that fewer people have been denied visas since 1981 than during the Carter administration. He said Randall's surrender of her citizenship was "a very serious act. If she never decided to do that, she'd still be a citizen regardless of whatever critical remarks she makes."

Randall said she relinquished her citizenship when she moved to Mexico with her first husband, a Mexican, because she could not find work without becoming a Mexican citizen. "If I committed any error, it was the ignorance of the importance of citizenship," she said.

An administrative law judge rejected Randall's residency application this month. "Her books advocate the doctrines of communism and support the communist government of Cuba, Vietnam and Nicaragua from 1966 to 1981," the decision said. "There are constant references to the United States as 'the enemy' in her books."

The ruling cited Randall's praise for a speech by Cuban President Fidel Castro. "Fidel was right-on as always. We felt the passion, and it released, to some extent, the anger in us all," she wrote.

It also cited a poem in which Randall used the spelling "Amerikkka," referred to inmates at New York's Attica prison as brothers and called law-enforcement officials "pigs." In another instance, Randall criticized the U.S. bombing of Cambodia during the Vietnam war and wrote that in 1975 "the Vietnamese Revolution has won its greatest victory. U.S. imperialism has suffered [its] greatest defeat."