The United States, after an all-out effort brought on by the discovery that its unmanned cruise missiles could not be fired against Libya in the 1986 raid that cost the lives of two fliers, now has dozens of the weapons capable of attacking targets in Iran, according to Pentagon officials.

Detailed data on land features along the Iranian coast has been gathered by satellite and aircraft so the Tomahawk cruise missiles aboard many of the big U.S. ships in the Persian Gulf and North Arabian Sea could follow the terrain programmed into the missiles' mechanical brains and dive into such likely targets as the permanent Silkworm antiship missile sites near Bandar Abbas, officials said.

The detailed programming of the Tomahawks for attacking Iranian targets gives President Reagan the option to use unmanned weapons if he should order any future strike.

Pentagon officials, in discussing this new capability, stressed that no Tomahawk raids are envisioned at this time. But using the missiles instead of manned aircraft would avoid the risk of harm to American fliers, officials noted.

The fine-tuning of the Tomahawks for the Persian Gulf involved not only mapping the terrain but making their non-nuclear warheads more powerful, sources said, so that such targets as underground shelters for Silkworm missiles could be destroyed.

Whether the Tomahawks are ever fired in anger in the gulf, their readiness marks a significant step across the gap between manned and unmanned weapons needed to make precise strikes in far-flung global hot spots, officials said. Some Navy leaders were dismayed that Air Force F111 bombers based in Britain and Navy A6E bombers from on carriers in the Mediterranean were used in the Libyan strike instead of the Tomahawks.

Navy officials who helped plan that raid said that the Tomahawks of that day were not adequately programmed, that their warheads were too small to destroy runways and planes on them and that the Navy had too few available in the region.

The Tomahawk can fly like a drone airplane to attack targets as far as 1,500 miles away. U.S. ships could fire them from outside the congested gulf in the Arabian Sea where the battleship USS Iowa, which Navy sources say has updated Tomahawks, has been operating.

A Tomahawk fired from a ship or submarine flies over the flat expanse of water and with radar detects land features on the coastline it crosses. By checking the land features against a contour map contained in its mechanical brain, the Tomahawk can determine its location and guide itself into the target.

"We had maps of Iran," one military planner said, "but not with the kind of detail you need. We had to do a lot of overhead photography." The terrain data computerized into Tomahawks deployed to the gulf is being constantly updated through frequent transmissions from the United States to the gulf via satellite, official said.

The missile can be programmed to fly from a ship at low altitude and then pop up over its target and dive into it. The warhead can be set to explode after the missile has dived into the earth, sources said.

The new combat readiness of the Tomahawk comes as the Navy and Reagan administration are looking for a way to reduce the U.S. gulf fleet to save money. Last week, the Commission on Integrated Long-Term Strategy, in a report to Reagan, recommended using precise, unmanned, non-nuclear weapons whenever possible.

Partly because the gulf deployment is putting heavy demands on money and manpower at a time of budget cuts, some Navy leaders contend the United States should reduce its gulf commitment. Defense Secretary Frank C. Carlucci has promised to keep an adequate U.S. presence in the gulf, but some leaders argue that the current force of 30 ships plus fine-tuned Tomahawk weapons are more than adequate, especially in light of a $11 billion cut the Navy has been ordered to make in its fiscal 1989 budget.

"The threat in the gulf hasn't changed since we decided {last summer} the command ship LaSalle and eight warships were enough," said one military planner in arguing the current force could be safely cut. The administration committed that force after the president decided to escort U.S.-flagged Kuwaiti tankers. The Navy has been escorting ships since July.

The now-credible Tomahawk retaliatory threat, together with the guns on Navy warships and the demonstrated effectiveness of the Army's Task Force 160 helicopter gunships stationed in the gulf, are being cited in behind-the-scenes arguments for a reduced U.S. naval presence in the Persian Gulf.

The Tomakawk, Sea-Launched Cruise Missile (SLCM) is designed to attack land and naval targets using either nuclear or conventional warheads. Submarines fire the missile through a torpedo tube; surface ships fire the missile from armored box launchers on deck or from vertical launch systems.

Length: 21 feet

Diameter: 21 inches

Wing span: 8 feet, 7 inches

Cruise engine: turbofan engine in the 600-pound thrust class

Cruise speed: about 550 miles per hour

Land-attack range: about 1,500 miles

Antiship range: about 275 miles

History: Initial studies for the Tomohawk began in 1972. There have been more than 100 test flights from submarines, ground platforms and aircraft since 1976.