Retired Gen. Mark Clark, 87, a brilliant and sometimes controversial Army group commander in Italy in World War II and the last head of United Nations forces in Korea during the conflict there, died of pancreatic cancer yesterday at the Medical University of South Carolina in Charleston, S.C.

Gen. Clark first saw combat in World War I, during which he was wounded. His service in World War II included a notable cloak-and-dagger mission to North Africa and command of the U.S. Fifth Army in Italy, the job for which he was best known. His principal campaigns were the bloody landing at Salerno, Italy, in which he himself led an attack against German tanks threatening the beachhead; the lost opportunity of Anzio, an amphibious attack that might have opened the way to Rome but resulted in a lengthy stalemate; the bitter and costly fighting for Monte Cassino; the capture of Rome and the ultimate liberation of Italy.

After the war, he was U.S. High Commissioner in Austria and commander of Army Ground Forces. He retired from active duty in 1953 at the conclusion of his service in Korea and the end of the conflict there. From 1954 to 1965, he was president of The Citadel, a military college in Charleston, S.C.

Gen. Clark, a tall, energetic man known for his intelligence, courage and charm, was the youngest Allied-Army group commander in the war. Winston Churchill called him "an American eagle." General of the Army Dwight D. Eisenhower said he was "the best organizer, planner and trainer of troops that I have met." General of the Army George C. Marshall, the wartime chief of staff, praised him as "a very good soldier and very loyal."

If his superiors praised him at the time, most historians have been content to state the problems Gen. Clark faced and the solutions he brought to them, and to let these speak for themselves. In general, they provide a sense that the general did a difficult job well.

Like other major operations, the one Gen. Clark conducted in Italy was dictated not only by the relative strength of the opposing sides, but by geography, politics, and strategic considerations, both in the Mediterranean theater and elsewhere in the world. In some of these categories Gen. Clark and his troops were at a loss to muster parity, much less superiority.

Most obvious was the matter of terrain. The Allies' task was to dislodge an enemy that enjoyed nearly every advantage the lay of the land could offer. The narrow Italian peninsula with its high ribbing of mountains forced attackers into head-on assaults. There were few opportunities for rapid and sweeping armored envelopments, such as those conducted by the Germans early in the war and by Gen. George S. Patton and other Allied commanders on the plains of northern and eastern Europe later in the conflict.

The frontal attacks were costly and gained little. An alternative was an amphibious flanking movement, such as the one at Anzio. For want of effective leadership on the ground, the opportunity presented by Anzio was lost, and it, too, settled into months of bitter and unproductive fighting.

In addition to terrain, there were the problems inherent in such a heterogeneous force as the 15th Army Group. Gen. Clark took command in December 1944, succeeding Field Marshal Sir Harold R.L.G. Alexander of Britain. The group was made up of units from 26 nations and the general had only varying degrees of control over the various components. His enemy, by contrast, was led by a unified German command that had some of the best soldiers and officers in the history of Europe.

Adding to those problems was the fact that for political and strategic reasons Italy was to a certain extent a "forgotten" war. The Normandy invasion and the battle in the Pacific received priority in terms of officers, men, materiel and precious naval units.

Whatever the difficulties, Gen. Clark never lacked critics, including some subordinate commanders and some historians.

They fault him for Salerno, where the Allies nearly were thrown back into the sea, and for Anzio. They fault him for the destruction of the historic abbey at Monte Cassino. They fault him for the heavy casualties his army took for little gain.

They fault his strategy, asserting that it contributed to the degeneration of the Italian fighting into a prolonged slugging match. They contrast it to the lightning advances achieved in northern Europe and the comparatively bloodless drives of Gen. Douglas MacArthur in the Southwest Pacific.

But the criticism does not change the fact that Gen. Clark conducted one of the most difficult campaigns of the war and brought it to a successful conclusion.

In a written statement, President Reagan praised Gen. Clark as a soldier who served "with courage, dignity, integrity and, above all, honor. General Clark's memory will live forever in the hearts of his countrymen."

Mark Wayne Clark was born on May 1, 1896, at Madison Barracks, N.J. He graduated from the U.S. Military Academy at West Point in 1917 and was commissioned in the infantry. He was wounded in France in 1918 and later served with occupation forces in Germany.

Between the world wars, he graduated from the Army War College, the Command and Staff College and the Infantry School at Fort Benning. He was attached to the Army General Staff when this country entered World War II. He became chief of staff of Army Ground Forces in May 1942, and in July of that year he became commander of all American Ground Forces in Europe.

Before the 1942 Anglo-American invasion of French North Africa, Gen. Clark made a daring secret trip to Algiers, where he attempted to persuade French Vichy Forces to welcome rather than fight American forces when they came ashore. His memoirs of this hazardous voyage by submarine and rubber boat, and his nocturnal wanderings and secret rendezvous with French officials, make exciting reading.

Although the mission was not entirely successful, it resulted in arrangements that greatly reduced the opposition that French forces put up to Allied landings.

The Fifth Army was activated in January 1943 at Oujda, Morocco. It was composed of the U.S. VI Corps under Maj. Gen. John P. Lucas and the British X Corps. With the British Eighth Army under Field Marshal Sir Bernard L. Montgomery, it made up the 15th Army Group.

The Army Group, led by Field Marshal Alexander, invaded Italy in September 1943. The Fifth Army hit the beaches at Salerno on the 9th. Italy had announced it was leaving the Axis and surrendering to the Allies only hours before the landing. The Americans, perhaps anticipating little opposition, were stunned by furious counterattacks by German forces, who had no intention of conceding Italy to the Allies.

With the beachhead in danger and some senior commanders planning to evacuate the troops, Gen. Clark announced that he was landing to take command of the forces ashore. He personally led an infantry assault against a group of 18 tanks that almost had reached the shore. The Germans were turned back and six of their tanks were destroyed. The general called upon airborne troops to drop between the Allied front line and the sea to reinforce the beachhead.

For his actions on the beachhead, Gen. Clark was awarded the Distinguished Service Cross, the Army's highest award for valor except for the Medal of Honor. The citation spoke of his "utter disregard for personal safety" while he "spread an infectious spirit of determination and courage."

The northward advance from Salerno, through the mountains, was slow and costly. In January 1944, halted 90 miles south of Rome by the German Gustav Line, Gen. Clark developed a plan calling for a coordinated attack on the German positions and an amphibious end-run 60 miles behind the line.

The forces aimed across the Rapido River at the Liri Valley were bloodily repulsed in the Gustav Line, while the VI Corps went ashore unopposed at Anzio. Instead of driving for Rome or moving to take the Gustav positions in the rear, Gen. Lucas, the corps commander, chose to advance less than 10 miles and await reinforcements and supplies. The Germans had time to gather enough forces to halt the Anzio invasion in its tracks.

These operations were the ones that brought the greatest criticism of Gen. Clark. After the war, a group of former 36th Infantry Division officers appeared before a Senate committee to oppose a promotion for Gen. Clark. They said his orders to cross the Rapido sent their division against impossible odds at the cost of enormous casualties. A War Department investigation concluded that the commander had exercised "sound judgment," and he was promoted.

The Anzio landing took place on Jan. 22, 1944. On Feb. 15, heavy artillery and air bombardment destroyed the historic Benedictine monastery on Monte Cassino. Gen. Clark had opposed this, not only on religious and cultural grounds, but also because the attack would be of little military significance. He was over-ruled and the abbey was turned to ruins. For some, the responsibility remains with Gen. Clark.

It was not until May 25 that the forces fighting through the Gustav Line and those at Anzio linked up.

Just prior to this, Gen. Clark made what was perhaps his biggest mistake of the war. He tried to seize Rome rather than encircle German forces on the Gustav Line. The result was that large numbers of German soldiers escaped to the north and Rome was not captured until June 4, 1944, just as Allied forces were preparing to go ashore in Normandy.

The war ended for Mark Clark on May 2, 1945. He spent the next two years as Allied High Commissioner in Austria, where his flinty disposition was a fitting match for his Red Army counterparts.

From 1949 to May 1952, he was commander of Army Ground Forces. He then succeeded Gen. Matthew B. Ridgway as U.S. commander and supreme commander of U.N. forces in Korea. It was a time of frustrating negotiation rather than fighting. On July 27, 1953, he signed the armistice that resulted in the end of the Korean conflict.

In the 1950s, Gen. Clark, who lived in Charleston, wrote two volumes of war memoirs, "Calculated Risk" and "From the Danube to Yalu." He caused a wave of protest because only reluctantly did he support the racial integration of the Army. More recently, he criticized the all-volunteer service policy and called for a return to the draft.

In addition to the Distinguished Service Cross, his decorations included four Distinguished Service Medals, the Legion of Merit and the Purple Heart Medal. He also received high honors from Britain, France, Belgium, Morocco, Poland, Brazil and the Soviet Union.

Gen. Clark's first wife, the former Maurine Doran, died in 1966. Their daughter, Patricia Ann Oosting, died in 1962.

Survivors include his wife of 17 years, the former Mary Mildred Applegate, of Charleston; a son by his first marriage, retired Army Maj. William Doran Clark of Washington, and four grandchildren.