The assassination of President Anwar Sadat is likely to heighten regional and international concern over the continued stability of neighboring Sudan, where President Jaafar Nimeri last week reportedly quashed yet another coup attempt that his top aides blamed on Libya.

Although no connection has been uncovered between the alleged plot in the Sudan, reports of which began to filter into Cairo last weekend, and the Sadat assassination, reportedly by domestic religious extremists, Egypt is linked to Sudan by a defense pact and regards that nation's security as an integral part of its own.

Sadat and other high-ranking Egyptian officials recently repeated warnings to Libyan leader Muammar Qaddafi that Egypt will immediately intervene militarily to aid Sudan should any Libyan attempt be made to unseat Nimeri.

Reports from official and unofficial sources in the Sudanese capital of Khartoum said security officials have uncovered a Libyan-organized secret underground army that was preparing to move against the Nimeri government.

They said that between 5,600 and 8,000 illegal immigrants and suspects are being held in connection with the alleged conspiracy following a month-long crackdown on the large refugee population located in and around Khartoum. Altogether, more than 17,600 persons were rounded up in the dragnet, according to the reports.

Security officials also seized 2,263 rifles and other weapons that had been infiltrated into the country and were found in vans and trucks around Khartoum, the reports said.

Details of the alleged Libyan-backed plot emerged during the visit to Washington, just a week before Sadat's death, of Egyptian Vice President Hosni Mubarak, who was reported here to be taking an urgent message to President Reagan regarding the situation in the Sudan.

Egypt wants the United States to rush additional arms, including antiaircraft missiles, to the Sudan to help it counter a threat from Libya along its western border with Chad, where more than 10,000 Libyan troops are stationed.

Libya has been repeatedly accused of involvement in the dozen or so previous failed coup attempts against the 12-year-old Nimeri government.

Western diplomatic sources here said in interviews before Sadat was assassinated that Egypt and the United States have already discussed contingency plans for a possible American airlift of Egyptian troops to the Sudan in an emergency. It was not known whether this plan was discussed by Mubarak during his visit to Washington and talks with President Reagan, Vice President George Bush, Secretary of State Alexander Haig and other top officials.

Both Sudanese and Egyptian leaders seem to be convinced that Qaddafi is actively working once again to organize a coup against Nimeri, making use of the large Libyan military presence in Chad as well as Sudanese and Chadian workers in Libya to form an antigovernment commando force.

In July 1976, Nimeri was almost overthrown when about 1,000 dissident Sudanese and refugees allegedly trained in Libyan camps infiltrated into the capital while he was on a visit to the United States and France. It took three days of hard street fighting in which 700 of the rebels were killed to crush the insurgency which still haunts the memories of Sudanese leaders.

Reports reaching here from the Sudan, although sketchy, suggest that Sudanese officials believe Qaddafi was seeking to mount a similar operation again.

Sudanese officials, quoted by the official Sudan News Agency (SUNA), said Qaddafi had organized a "Salvation Army for the Liberation of the Sudan" and was impressing Sudanese workers and other refugees in Libya into training camps.

Sudanese who refused to join were being expelled from the country at the rate of between 3,000 and 4,000 daily, the report said.

These returnees together with some of the detainees provided information on the alleged Libyan plot, the Sudanese news agency reported.

"Some of the returnees had been beaten up and tortured" for refusing to join the training camps, it said.

It added that a number of the illegal immigrants being held in detention had confessed "that they were recruited by Libya to work against the security of the Sudan."

There are an estimated 500,000 refugees from Chad, Uganda and Ethiopia living in the Sudan, and their presence has become a growing burden on the economically hard-pressed and politically troubled Nimeri government.