NEW YORK -- Thomas W. Gleason, the dockworkers' strongman who won guaranteed pay for his men and used union muscle to promote his views on foreign policy, is retiring after 24 years as head of the International Longshoremen's Association.

Gleason, "Teddy" to everyone in the shipping industry, is the nation's oldest union president and he cited his age when he announced in March that he would not seek a seventh four-year term.

He will be 87 on Nov. 8. His birthday is a paid holiday for the ILA -- just another benefit negotiated by Gleason for dockworkers on the Atlantic and Gulf coasts and throughout the Great Lakes. West Coast longshoremen have a different union.

A dockworker and union man for 73 years, Gleason shaped an unruly mob of workers into a labor organization strong enough to influence international politics and brought stability to a volatile, strike-prone industry.

"We got everything we fought for," Gleason said.

Since he began working on the docks in 1915, Gleason has seen the union weather wildcat strikes, riots, boycotts and racketeering scandals. When he became president, Gleason immediately faced the challenge of automation as container ships replaced freighters and greatly reduced the need for gangs of strong-backed dockworkers.

Fiercely protective of the rank and file and recognizing that a decline in membership was inevitable, Gleason fought for, and won, a steady paycheck whether there was work or not.

"We sold our souls for that," Gleason said of the guaranteed annual income (GAI), introduced in 1964. It was a revolutionary idea and his crowning achievement.

But it also closed the door on the ILA; from 1964 until 1977, not a single longshoreman was added to the roster. Membership has dropped from 165,000 at its peak to fewer than 60,000. The few who have been hired since 1977 are not eligible for GAI. The union has aged with Gleason, and the average age of dockworkers in New York is 58. More New York dockworkers draw pensions, 14,000, than work, about 8,500.

"Teddy Gleason's long career as a labor statesman spanned a pivotal period in longshore labor-management relations -- the container revolution," said Anthony Tozzoli, president of the New York Shipping Association. "He has been a forceful and effective advocate of the interests of his members."

Gleason's diamond-studded tie pin spells "ILA," and he jokingly claims it stands for "I Love America." Outspokenly anticommunist, he has often been involved in politics.

For eight days in 1963, Gleason refused to load surplus wheat sold to the Soviet Union until the administration bowed to the ILA's demand that half the grain be carried in American ships. Then-Commerce secretary Luther Hodges accused him of making foreign policy.

Autographed pictures of every post-war president except Jimmy Carter hang in his office. He bucked Carter by refusing to handle Russian cargo after the Soviet Union invaded Afghanistan. The boycott lasted more than a year until Gleason lifted it at President Reagan's request.

He engineered ILA endorsements of Presidents Nixon and Reagan. He exercised his clout through his role on numerous governmental advisory boards, civic and fraternal organizations and Irish-American groups.

Gleason will officially step down this week at the union's quadrennial convention in Bal Harbour, Fla., and is expected to be elected president emeritus. A widower since 1961 and the father of three sons, he plans to continue going to the office every morning at 6:30 "to stay away from that cemetery." His health is good. He underwent prostate surgery in February but marched in the St. Patrick's Day Parade three weeks later.

He has endorsed his friend, John M. Bowers, 61, the ILA's longtime executive vice president, for the top job. Bowers, elected to his post the same year Gleason became president, has no opposition.

Gleason's popularity was cemented by the guaranteed annual income. For the first time in history, workers who showed up in the morning would be paid for a full day's work even if there was no work to be done.

"It was like Santa Claus," Gleason said of GAI.

Workers were guaranteed 2,080 hours a year. At the current wage of $17 an hour, that's $35,360 a year. New York shippers have paid out more than $1 billion in GAI, Gleason boasted.

So it was an especially bitter pill when, last November, the GAI in New York was trimmed to 1,900 hours in a move to help shipping companies cut costs and boost efficiency. It was reduced even more in the South Atlantic and abolished altogether in the West Gulf.

For the first time, there is no single "master contract" for all ports from Maine to Texas, and some of the regional settlements contained the first pay cuts in 50 years.

In a recent interview, Gleason refused to talk about union problems.

Once one of the strongest unions in the country, the ILA has been challenged by nonunion port facilities, containerization, deregulation of trucks and trains, the nation's trade deficit, the widespread use of flags of convenience, management demands for concessions and a decline in the American shipping industry. The number of American flag ships has declined from 16,000 before the container revolution to about 600 now.

When Gleason was born in 1900, ships were the only way to circle the globe. The eldest of 13 children and a third-generation dockworker, he was born in a Greenwich Village tenement to Irish immigrant parents.

To help support the family, at age 15, he dropped out of school and began working on the docks for 10 cents an hour. In the Great Depression year of 1932, he was blacklisted for his union activity and for a time sold hot dogs at Coney Island.

Under New Deal laws sanctioning unions, Gleason returned to the docks and was elected a union organizer. He led wildcat strikes in 1946, 1949 and 1951, each time winning additional benefits.

When he became president, he helped stabilize the industry by agreeing to three-year contracts and in return won generous wages that made his men among the highest paid manual laborers in the country.

The ILA was the target of a racketeering investigation in 1951, which brought the indictment of ILA President Joe Ryan on theft and corruption charges and inspired the Oscar-winning film, "On The Waterfront."

Another corruption scandal broke in 1979, and three dozen high-ranking ILA officials were convicted of federal racketeering charges.

This year, Donald Carson, the ILA's general organizer and third-ranking official, is under federal indictment in New Jersey for an alleged racketeering scheme involving Mafia figures.

Allegations of waterfront corruption are as old as the industry, but Gleason, a shrewd and popular leader, has never been indicted.

In 1985, the President's Commission on Organized Crime said the ILA was mob-controlled. While conceding that some officials had done wrong, Gleason denied the mob influenced him or his union.

''There's no way I could be tied up with the Mafia; I'm Irish,'' declared Gleason.

And, he added with a grin, ''I believe in the Seventh Commandment'' -- Thou shall not steal.