Egypt and Israel have decided to allow ordinary citizens of the two countries to travel back and forth at will, Egyptian Prime Minister Mustafa Khalil announced today.

They will be permitted to travel only by air or sea, not overland through the Sinai, and will require clearance in advance, Khalil said. But the only other restrictions are those applied by the two countries to any other foreign travelers.

Khalil said it might be "less than two months" before such travel actually begins and the only limitation on the number of Israelis allowed to come here would be the availability of accommodations.

Khalil was speaking to reporters outside his office after a two-hour meeting with Israeli Foreign Minister Moshe Dayan. Dayan concluded a three-day visit in which he and the Egyptians discussed how to implement the decision May 27 by President Anwar Sadat and Prime Minister Menachem Begin to open the border.

Dayan said he was "satisfied" with what he called "the first real test of the practical implications" of the treaty signed by Egypt and Israel in March.

As expected, Khalil said the national airlines of Isael and Egypt will not provide direct air service between Cairo and Tel Aviv for some time. He said international airlines would be welcome to do so but that he did not know if any would.

Trans World Airlines of the United States, which flew between Cairo and Tel Aviv in the 1940s and still serves both, was expected to apply for a renewal of its flights. But TWA has denied that it has any plans to fly the Cairo - Tel Aviv route, reportedly because of threats by Palestinian groups.Any other airline probably would face the same problem, which make it necessary for passengers between Tel Aviv and Cairo to travel via Athens until El Al or Egyptair eventually begin flying.

The outcome of Dayan's visit was different from what the press in both countries predicted. Egyptian and Israeli reports said the two countries probably would allow Israeli fishermen and Egyptian workers in the Sinai to cross the border there to work, but would limit other travel to journalists, scholars and professionals on specific missions.

Israel's request for the fishermen to use Lake Bardawil and for the workers to go back to their jobs was turned down by Egypt in Dayan's first round of talks with Egyptian Deputy Foreign Minister Boutros Ghali and the easing of restrictions on other travelers apparently was to balance that.

This week marks the 12th anniversary of Israel's rout of Egypt in the six day war, the blackest hour in modern Egyptian history. Dayan helped engineer that blow and ever since his name was evoked fear and hatred here, but he received a cordial welcome, demonstrating that Egyptians consider the era of confrontation to be in the past.

Dayan said he received "more than I expected and more than I deserved" on his visit. He was received by Sadat and taken to see the great Pharaonic monuments at Luxor in upper Egypt. He and Ghali are to meet again before the end of the month in Beersheba, Isreal.

Khalil said citizens of Egypt and Israel who are in third countries can apply for visas at the nearest consulates, and the consulates will be authorized to issue them without checking home.

Khalil and Dayan said they did not even touch upon the much tougher issues still awaiting resolution between Egypt and Israel, that of Palestinian autonomy. That is to be discussed inegotiations that resume Monday in Alexandria.