The United States is giving Sudan's new military government $40 million to help finance its short-term oil import needs, but the State Department said yesterday that the decision to advance the funds was made before the overthrow of President Jaafar Nimeri last Saturday.

"This is not a new decision taken after the coup," department spokesman Ed Djerejian said in response to questions about whether the petroleum project was discussed when Nimeri was here the week preceding his ouster by the Sudanese armed forces.

Djerejian also stressed that the $40 million was "not new assistance that was approved after the coup." Instead, he said, the funds are part of $67 million that had been appropriated for Sudan's use during fiscal 1984 and that the administration agreed to release during Nimeri's visit here.

The administration previously had frozen almost $200 million in aid earmarked for Sudan to force Nimeri to make major economic changes, including steep increases in the price of food and gasoline. The increases led to demonstrations that helped trigger the coup.

Nevertheless, the administration said earlier this week that it intended to continue U.S. aid as a means of helping the regime headed by Gen. Abdel Rahman Sawar-Dhahab cope with Sudan's many economic problems. The Sudanese news agency, in announcing that the oil agreement was signed in Khartoum on Tuesday, called it a show of support for the new government.

Djerejian characterized the $40 million grant as "a petroleum project to facilitate oil importation." He added that the first shipment, valued at $20 million, is scheduled to arrive in Sudan May 1.