Violence broke out in the Sudanese capital of Khartoum yesterday in response to food price increases imposed by President Jaafar Nimeri as part of an agreement that is likely to lead to resumption of $180 million in U.S. aid to the Sudan.

The aid was suspended last December because of growing doubts over Sudan's political stability and near-bankrupt economy. Sudan is the most important U.S. aid recipient in black Africa.

The belt-tightening agreement was worked out with the International Monetary Fund before Nimeri's scheduled arrival here last night for a two-week visit.

Riots erupted in Khartoum over a 30 percent increase in bread prices and a 66 percent rise for gasoline announced Monday apparently as part of the deal worked out between the Sudanese government and the IMF.

News agency reports said police had opened fire in the city's downtown on several thousand students who had set fire to buildings, smashed hotel, shop and car windows, burned tires and chanted anti-American and anti-Nimeri slogans in protest over the new austerity measures, which were imposed by ending government subsidies.

At least two demonstrators were reported killed and a "substantial number" were wounded, according to State Department sources. Last night the Khartoum airport was reported closed.

"The question is what happens tomorrow," remarked one State Department official.

Nimeri was to arrive here last night for medical treatment and talks with President Reagan and other top administration officials starting Monday. So far as was known yesterday, the Sudanese leader had not decided to return to Khartoum because of the rioting, State Department sources said.

Last Monday, Nimeri announced an end to all state subsidies on food and textiles, a longstanding demand of the IMF and the United States as a way of restoring donor confidence in his oft-declared intention to come to grips with Sudan's disastrous economic situation.

This move followed talks in Khartoum with an IMF mission that returned to Washington Tuesday.

Sudanese Ambassador Omer Eissa said an effective agreement had been reached with the IMF delegation on all economic reforms demanded by the fund but that its top management had yet to review and approve it formally.

An IMF source confirmed that Sudan was indeed moving "in the right direction" but said "agreement" was the wrong term because fund rules technically forbid either "negotiations" or an accord with a country in arrears on its payments. He remarked, however, that it "looks like they have come to grips."

Sudan is now about $100 million in arrears.

The source explained, however, that if IMF managers were satisfied with the reforms Nimeri has agreed to implement, a report stating so would be sent to donor countries "to see what they can do." This would clear the way for a new meeting of donor countries, grouped in the Paris Club, to discuss yet another rescheduling of Sudan's nearly $9 billion foreign debt and possibly a new IMF standby agreement once its arrears are paid.

A senior State Department official said it look as though "the gap" between the positions of the IMF and the Sudanese government had been bridged, and he remarked, "If they agree with the IMF, it's good enough for us."

The United States last December decided to delay the disbursement of most of the $120 million in U.S. economic support funds earmarked for Sudan but still unspent from the 1984 fiscal year.

In all, there is still $67 million in fiscal 1984 economic aid waiting to be released plus $114 million for this year, for a total of $181 million.

Regular development assistance, amounting to $28 million this year, and emergency food assistance, reaching $60 million and 237,000 tons of food as of March 1, were not affected.

The likelihood now is that the U.S. government will announce resumption of the frozen economic support aid while Nimeri is in Washington, possibly when he meets Reagan next Monday,

The resumption of U.S. assistance is certain to encourage other donor countries, some of which have also frozen or delayed portions of their aid, to join in this latest attempt to salvage the Sudanese economy and bolster the politically troubled Nimeri regime.