Dressed in neat battle greens, with a gun holstered on his hip, a black commando beret poised cockily on his head and field marshal's shoulderboards, President Saddam Hussein was playing his role as Iraq's ubiquitous ruler.

At a military base along the banks of the Tigris River he met with a detachment of soldiers just back from the siege of the Iranian river port of Khorramshahr and lavished praise on them for their "noble mission" for the Arab nation.

Then, driving his own car, sandwiched in a flotilla of security limousines, he sped off to a baghdad suburb to sip tea in the home of a blackshawled grandmother and her family before walking in the neighborhood while neighbors shouted praise of his leadership.

Minutes later he was back in his own palm-surrounded presidential palace, sitting on an embroidered couch, meeting an envoy from the ruler of Kuwait.

With Iraq in its seventh week of warfare with neighboring Iran, Iraqi television daily offers a similar fare of its president making the rounds of his captial and acting as if he has hardly a care.

The image of a popular, active and respected ruler that the 43-year-old Saddam Hussein seeks to project is offset only by the stony expression that he seems incapable of shaking. The image is also in stark contrast with the president's reputation as a ruthless, shrewd tyrant whose lust for power, at home and in the Arab world, is said to be matched by a cold-blooded vengeance against those who have dared stand in his way.

Ambition and vindictiveness, as much as the historic enmity between Arabs and Persians, are factors in the Persian Gulf war, which Saddam Hussein, according to mounting evidence, has been planning since he took over the presidency from his one-time mentor, Ahmed Hassan Bakr, in July 1979.

This personal crusade against Iran, however, began long before he took over the presidency.

Middle Ease anallysts who have followed his career believe the die was cast for today's war in March 1975, when Saddam Hussein, already the Iraqi strongman as vice president of the Revolutionary Commanc Council, was forced to swallow his Arabic pride and sign a treaty of reconcilation with the late shah of Iran.

Saddam Hussein agreed to drop Iraq's longstanding claims to sovereignty over the strategic Shatt-al-Arab waterway that divides Iran and Iraq along their southern borders in return for the shah's promise to withdraw support from the Iraqui Kurds. The Kurds had been battling the Iraqi Army with such success that Bakr and Sadam Hussein feared for the survival of their Baath Party rule.

From that moment on, analysts here argue, he sought to avenge the humilation of being forced by "the Persian racists," as he calls them, to surrender sovereignty over territory long considered Arab.

Although Iraq continued its stand as one of the most radical of regimes in the Arab world, Saddam Hussein began to shift the focus of Iraqi foreign policy from a confrontationist line in the Arab-Israeli conflict to a policy directed at the Iranians, then trying to assure their dominance in the region as the "policemen of the gulf."

Iran's superior might, under the shah, forced Iraq to maintain cordial relations with Tehran. It even agreed in 1978 to expel to Paris Ayatollah Ruhollah Khomeini, who for 15 years had been living in exile in Iraq.

But even the Saddam Hussein was maneuvering to confront the shah. According to Iraqui intelligence sources, as earlly as 1976 secret agents were sent into Iran's oil-rich Khuzestan Province to organize an underground movement among the Arabs, who make up an estimated 40 percent of its population.

In 1978, he began courting the monarchies of Saudi Arabia and Jordan both of whom had little in common with his Baath socialist policies and whom he had, on occasion, tried to topple.

The shah's sudden overthrow in early 1979 set the stage for Saddam Hussein to challenge his Persian enemies. Anarchy had weakened the Iranian armed forces. In addition, the prospect that the ayatollah and his followers would suddenly spread Shiite power into the vulnerable oil emirates along the gulf coast and Saudi Arabia Forged the Arab axis Saddam Hussein needed to back up his challenge to Tehran.

By midsummer of 1979, clashes along the Iranian-Iraqui border ahd become almost a daily affair, and inside Khuuzestan Province Iranian Revolutionary Guards were involved in pitched battles with members of the Iraqui-inspired Organization of Arab Peoples that began demanding autonomy from Tehran.

When Saddam Hussein finally took over the presidency from Bakr in July 1979, he moved quickly to prevent any similar move in Iraq by Shiites attracted by the ayatollah or other groups. He had already purged 67 leading Iraqi politicians from his party, adccusing them of leadiing a "communist conspiracy."

Within weeks of becoming president, he said he had uncovered another communist plot. Twenty-one persons, many of them ranking Baathists who had been his closest associates in the party, were executed as he watched.

Preparing for war with Iran, Saddam Hussein next preemted any challenge from the Iraqi Shiites, whoo make up 60 percent of the population and have long resented being ruled by Sunni Mosslems, the sect of which he is a member.

When Deputy Prime Minister Tareq Aziz was slightly wounded in an assassination attempt this spring by an allegedly Shiite group including one Iranian, who was killed, Saddam Hussein moved on the Shiites.

Some 40,000 Iranian-born Shiites were taken to the Iranian border and forced to walk across. Other thousands of militant Iraqi Shiites were jailed. Iraq's most militant ayatollah, Mohammed Bagher Sadr, was arrested and secretly executed.

Saddam Hussein, as the first nonmilitary president since the 1958 revolution, courted the armed forces, on whom his power ultimatelly rests. In his first yar, he increased Iraq's already high defense budget by 25 percent, not only to build up ammunition, spare parts and weapons sufficient for the war he was planning, but also to curry favor with the military through such perquisites as better pay, housing and access to consumer goods.

It remains unclear what particular incident finally led him to order his Air Force to strike deep into Iran against its air bases on Sept. 22, the act that marked the opening of full-scale war.

But in August of this year, Saddam Husseiin made a unique and historic pilgrimage to Saudi Arabia to meet with King Khalid and the leading princes of the house of Saud. Although the details of what transpired remain secret, it is clear that Saddam Huseiin firmed up Iraq's relations with Saudi Arabia and, diplomats here believe, won Saudi Arabia's private acquiiescence for the war he was about to launch.

On Sept. 17, with clashes along the Iraqi-Iranian border getting more intense by the day, Saddam Hussein summoned his newly created national assembly to an extraordinary meeting to announce his unilateral abrogation of the 1975 Algiers treaty between Iraq and Iran. Less than a week later he launched his Soviet-built air force to clear the way for his Army's invasion of Khuzestan Province.

"Frankly, the point at which Saddam Hussein really decided to go for broke may never be known," said one Western analyst in Baghdad, "but it is clear from everything that has happened here in the past year that he has been planning just such a showdown with the Iranians who humiliated him, ever since he became president."

The war is not presented to the Iraqi people as thier war against the dastardly Persians. It is known simply as "Saddam's Qadisiyah," in reference to an ancient battle at the town of that name in 637, when the Arabs first pushed the Persians of the decadent Assyrian empire out of what is today modern Iraq.