Egypt said today it had accepted a Soviet invitation to talks next month that could heal the long-standing rift between Cairo and Moscow.

Egyptian Foreign Minister Ismail Fahmi told a parliamentary committee here that he will meet Soviet Foreign Minister Andrei Gromyko in Europe June 9 and 10.

"It is a constructive Soviet initiative which Egypt welcomes," Fahmi told the Foreign Affairs Committee. He said the proposal was put to him yesterday by the Soviet ambassador to Cairo, Vladimir Polyakov.

An improvement in Egyptian-Soviet relations would appear to reflect a wish by both countries to boost Middle East peace-seeking efforts, including a resumption of Geneva conference.

A significant turn for the better in its ties with Cairo would give Moscow the opportunity to play a larger role in Middle East peace maneuvering. The Soviet Union has no diplomatic relations with Israel. This, combined with the recent chill in its dealings with Egypt, has reduced the Kremlin's influence despite its role as cochairman of the Geneva conference.

There have been recurrent rumors that the Soviets, to strengthen their political presence in the region, are also moving toward establishing diplomatic ties with Israel.

President Anwar Sadat, abrogated a friendship treaty with Moscow in March last year. That followed his expulsion of 20,000 Soviet military experts in 1972 and Kremlin refusal to supply Egypt with military equipment after the 1973 Arab-Israeli War.

Diplomatic ties also seemed near rupture last week when Cairo denounced Moscow for handing Arab countries a note that newspapers here said accused Egypt of trying to provoke an armed clash with Libya.

Cairo newspapers later said the Soviet Union had withdrawn the note and expressed its wish to improve relations.

If next month's talks clear the atmosphere, President Sadat and Soviet Communist Party leader Leonid Brezhnev could meet.

Sadat has said repeatedly that he is ready to meet Brezhnev if sufficient preparations are made to insure a success of their talks.

The belief that Middle East peace efforts are behind the latest move is strengthened by the arrival here today of Syrian Foreign Minister Aedel Halim Khaddam, who is believed to be carrying a message from President Hafez Assad to President Sadat.

Khaddam, at the start of a tour of several Arab countries, flew to Alexandria to meet Sadat. Assad conferred in Moscow last month with Kremlin leaders on the Middle East. Observers also believed that Assad might have played a role in attempts to heal the Cairo-Moscow riff.

Syria is currently Egypt's major ally in the confrontation with Israel, and the two countries are also loosely linked by a unified political command that Sudan recently joined.

Informed sources said criticism of the Soviet Union in Egyptian newspapers as well as radio and televishion commentaries will be stopped as of today.

Bitter attacks on the Soviet Union have been an almost daily feature in the Egyptian media for the past few months.