HUWAIZAH, Iraq (AP) _ The thunder of artillery filled the marshes and the firetrails of outgoing rockets lighted the twilight sky. Columns of Iraqi tanks clanked eastward through the wetlands on hastily built dirt roads.

A pair of legs in mud-covered boots protruded from a ditch beside one of the paths. The corpses of dozens of Iranian soldiers were strewn in the marshes beyond.

An Iraqi soldier smiled broadly and said ''plenty of them are buried'' under the tank paths built during the week-long Iraqi counteroffensive against the Iranian invasion force.

Military personnel took foreign and Iraqi reporters on a tour Monday of Huwaizah, a 1,158-square-mile marshland straddling the southern border with Iran, this Arab nation's enemy in a war that began 41/2 years ago and has intensified in recent weeks.

Iran sent an invasion force into the marshes early last week in an attempt to cut the main north-south highway and isolate the strategic port city of Basra from the rest of Iraq.

There were no Iranians to be seen in the border marsh areas. Iraqi officers told the visiting reporters the invaders were driven out in seven days of fighting, but acknowledged that the Iranians still held oil-rich Majnoon Island, which they also had seized in a similar offensive in February 1984.

Howitzers and multiple rocket launchers west of the highway fired at the rate of 10 shells a minute into positions on the Iranian side of the marshes. Four Iranian shells crashed into the 12-mile stretch of marshland southeast of Azair through which reporters were traveling in army buses.

Iraqi soldiers piled sandbags alongside the narrow trails, setting up firing positions. Hundreds of Soviet-made T-62 and T-54 tanks were deploying, their cannons pointed east toward the enemy.

Victory was not cheap. This reporter counted 45 gutted Iraqi tanks and personnel carriers. Maj. Gen. Sultan Hashem, commander of the East of Tigris forces, said they were knocked out during the initial Iranian drive and the counterstrikes that followed.

''The Iraqi counteroffensive, begun last Wednesday, encircled enemy troops and finished them off. There's not a single Iranian on our soil.'' he said.

Hashem said Majnoon, on the southeastern edge of Huwaizah, was not involved in the battle and ''remains in Iranian hands.''

The Iraqi general command said Monday that an Iranian invasion army of more than 100,000 was ''crushed and evicted'' with losses it said included ''30,800 soldiers killed, about three times as many wounded, and large numbers of others taken captive.''

In Washington, the New York Times today quoted senior Reagan administration officials as saying Iran has apparently suffered a crushing defeat. The report said officials estimated Iran sent 30,000 to 50,000 soldiers and badly trained volunteers across the border and that most of them were killed.

''This was the final battle which will put an end to the war and achieve peace,'' said the Iraqi chief of staff, Gen. Abdul-Jawad Zannoun.

Hashem, talking to reporters at his command post near the town of Azair on the Basra-Baghdad highway that the Iranians had tried to seize, said Iraq expected the invasion and had prepared a ''counter-plan to contain and destroy the thrust.''

He said that on March 11 the Iranians landed eight divisions of 13,000 men each on the west bank of the Tigris River in an attempt to cut the highway at Azair.

''They erected a number of pontoon bridges in the marshes and across the river,'' the general said, and managed to hold the area for a ''short time. ... But we took it back and wiped them out.''

''The Iranians were never on the highway,'' he said, but it ''came under shelling.''

Reporters were not allowed to travel from Azair to Basra.

Iraqi soldiers conceded there still were ''some isolated pockets'' of Iranian resistance in tiny reed isles scattered about the shallow waters between the Iraqi and Iranian sides of Huwaizah.

About 60 Iranian captives, including three officers, were taken away from Hashem's headquarters in buses for interrogation. Most of the prisoners were wounded and they were chained to their bus seats.

The officers, a captain and two lieutenants, were blindfolded.

The Tigris zigzags east of the highway between Azair and Qurna, a distance of 1.2 miles. The highway crosses both the Tigris and the Euphrates River in that stretch.

At their confluence farther south, the rivers form the Shatt al Arab estuary, through which part of the border between the two countries runs. Iraq invaded Iran in September 1980 in an attempt to gain full control of the Shatt, which is its only outlet to the Persian Gulf.