It was 1943 and the U.S. Army was already planning for the day it would be called upon to occupy and administer a devastated Europe. In the fever of war production, the Army had ordered a fleet of railroad cars, built on the narrower European gauge, that could be shipped on short notice and put into service on the tracks of France and Germany.

The cars were never needed, never shipped, never even assembled. For 30 years they lay in storage in their original crates at a supply depot in New Cumberland, Pa. Now they are getting ready to roll - on the rail line of Egypt.

In one of the most offbeat transactions of the massive American economic assistance program here, the United States has shipped 369 flatcars, Boxcars and add gondolas that were finally disposed of as surplus by the Army earlier this year. Built for European tracks and couplings, they were useless in the United States, but are compatible with Egyptian rolling stock.

According to Hans Bang, project coordinator for the U.S. Agency for International Development, the rail cars have been sold to the Egyptians at 18 per cent of their original 1943 acquisition cost. Egypt is paying $1.156 per car, including shipping costs, or less than half a million dollars for a whole fleet - a minute fraction of what it would cost to buy them in Egypt's railway car factory.

Bang and other Americans officials said that when they first spotted the rail cars on U.S. surplus property disposal lists and offered them to Egypt, the price was so low that Egyptian railway officials at first believed it was a mistake and did not respond.

The money for the purchase is coming from a low-interest, 20-year U.S. aid loan.

A grimy turn-of-the-century railroad workship here has been turned into an assembly plant for the cars. Wheels, axles, couplings, crates or air brakes and frames are strewn about like some giant's playthings. Except for some minor rusting and flaking paint, the equipment appears to be in good condition, but workers in the plant said some parts are missing and assembly cannot be completed until they arrive.

Unlike many developing countries, Egypt has an extensive network of railroads, dating back to the first Alexandria-Cairo line built by the British in 1852.

Some 2,700 miles of track link Cairo, the Suez Canal, the port of Alexandria, the industrial center at Helwan, the Libyan border town of Salloum and the tourist mecca of Luxor in Upper Egypt. Heavy passenger traffic, inadequate roads, the demands of the military and insufficient maintenance have strained the railroads' ability to meet the increasing demands on them. Ehypt needed new freight cars in any case, according to officials familiar with the transaction, and the American surplus fleet represented a most-unanticipated bargain.

The United States is reportedly considering providing financial assistance to enable the Egyptians to buy a new switching engines and refrigerated produce cars.