Prime Minister Kamal Hassan Ali and his Cabinet resigned tonight as Egypt continues an uphill fight to sustain its badly faltering economy. Ali's replacement, named by President Hosni Mubarak, is former finance minister Ali Lotfi.

Lotfi told reporters tonight he would be putting "new blood in the new Cabinet," and this generally was taken to mean putting a more technocratic team in charge of the nation's finance and development.

Foreign analysts trying to evaluate the surprise move thought it doubtful that the shake-up would result in changes in the key defense and foreign ministries.

The appointment of Lotfi, who was finance minister in 1979-80, appeared aimed mainly at breathing life into a moribund economy.

In April, Mustafa Said was dismissed as economics minister and subsequently attacked in court on charges of corruption. Now the team that replaced him also is out.

Said and his successors had attempted to reduce, as gently as possible, the government subsidies that have given Egyptians bread at a penny a loaf and gasoline for a few cents a gallon.

Recently, the government again began raising prices. In 1977, similar measures led to major rioting.

There have been no serious incidents during the current attempt, but the opposition parties have made increasingly vocal protests.

Lotfi, 49, has a graduate degree in economics from the University of Lausanne, Switzerland, has been a director of the Bank of Alexandria and is considered an expert on tax law.