Alan Barth, 73, an eloquent advocate of civil liberties and an editorial writer for The Washington Post for more than a quarter of a century, died of cancer yesterday at the Veterans Administration Hospital in Washington.

From the time he joined The Post in 1943 until his retirement in 1972, Mr. Barth wrote powerfully in support of the wider definitions of constitutional rights toward which the country was slowly moving.

Sometimes his editorials were sharp and stinging as were those that challenged the investigations conducted by the late senator Joseph R. McCarthy (D-Wis.). At other times, they were full of the humor and sense of the absurd that marked his own view of the world.

Although Mr. Barth did not set the policy of The Post's editorial page, he was often its spokesman on critical issues. He was instrumental, soon after he joined the newspaper, in changing its views on racial issues. It was in his words that The Post, in 1945, denounced the threat of Washington's white bus drivers to strike if the transit company hired black drivers. "To bar men from serving in these jobs because of their race or color is at once to hamper the war program and to subvert the principles for which the war is being waged."

And it was in his words that the paper vigorously defended freedom of speech and freedom of association during the McCarthy era. Mr. Barth's unwavering support for the constitutional rights of everyone, including some wrong-headed and even odious characters and causes, occasionally brought him into conflict with others on the newspaper's staff.

Philip L. Graham, the late publisher of The Washington Post, was furious with a Barth editorial in 1950 that defended the performance of Earl Browder, head of the American Communist Party, before the McCarthy investigating committee.

Mr. Browder had refused to identify his associates, and Mr. Barth had written: "In refusing to identify and stigmatize certain persons whose names were presented to him . . . Mr. Browder was patently in contempt of the committee's authority. But this contempt was pretty well earned by the drift and character of the questions . . . Not everyone in America tests a man's loyalty to his country by his willingness to betray his former friends."

The editorial became the centerpiece of a campaign against The Post, which already had been labeled pro-Communist, and Mr. Graham thought Mr. Barth had gone too far. He was intent upon firing Mr. Barth until Justice Felix Frankfurter persuaded him not to.

Through it all, Mr. Barth never wavered. He had been hired by Eugene Meyer, Mr. Graham's father-in-law and the newspaper's publisher then, who knew of his reputation as a strong liberal. Mr. Meyer said he wanted his editorial writers to "write with an assurance of freedom within their area of competence."

When he retired, Mr. Barth said, "I was never asked to grind anybody's ax or stuff anybody's shirt or pander to anybody's prejudice or pull any punches or consider the interests of any advertisers or politicians."

A mild-mannered, soft-spoken man, courtly in his ways, Mr. Barth did not often write under his byline in The Post. Editorials were then, as now, unsigned. But his personal views were expressed fully in a series of books, articles and speeches.

His first book, "The Loyalty of Free Men," was written at the height of the McCarthy era. It spread his reputation nationwide as it quickly became part of the common culture of college students. It set forth his philosophy.

"Congressional abuse and the distortion of the investigating power is threatening to establish in this country a legislative tyranny. Such abuse is threatening to overthrow the American form of government by upsetting its tripartite balance of power and usurping the powers reserved to the people," he wrote.

"Certainly there are real dangers to be faced. Espionage and sabotage are not imaginary threats to national security . . . But the antidote is not repression: it is free and unlimited discussion."

Mr. Barth also was deeply concerned about the abuse of academic freedom and of police investigative powers. He dealt with these matters in later books, "Government by Investigation" in 1955, "The price of Liberty" in 1961, and "Heritage of Liberty" in 1965.

In the "Price of Liberty," he was sternly critical of the often common police practice of detaining crime suspects without immediate arraignment and of unauthorized wire-tapping. He wrote:

"Every society is obliged to see a rational balance between public safety and private rights -- to choose between the exigencies of law and order on the one hand and the imperatives of freedom on the other."

Mr. Barth also was an advocate of gun controls. After the assassination of President John F. Kennedy, he waged a fruitless battle on The Post editorial pages against the National Rifle Association, which opposes controls. He wrote more than 1,000 editorials calling for gun controls, 77 of them on consecutive days.

But more often he saw his uncompromising positions on civil rights and civil liberties upheld. He favored school desegregation, and it came about with the Supreme Court decision in 1954. He wanted home rule for the District of Columbia, where he had lived since the 1930s, and saw the nation's capital win the vote.

In 1974, Mr. Barth published his fifth book, "Prophets with Honor," in which he wrote about 10 major dissenting opinions handed down in Supreme Court cases involving individual rights or liberties guaranteed by the Constitution.

Just as many of his own early and controversial positions on civil rights later were vindicated, so were those court dissents, which he noted "in time came to be recognized as right and to be adopted by the court majorities." t

Mr. Barth was born in New York City, where his family was in merchandising. He attended Phillips Academy in Andover, Mass., spent a year traveling around the world, and then earned a degree from Yale University.

He was in merchandising for several years, and then went to Beaumont, Tex., where he worked as a reporter for the Enterprise in 1936 and an editorial writer for the Journal during 1937-38.

From there, Mr. Barth come to Washington as a correspondent for the McClure Newspaper Syndicate. He was an editorial assistant to secretary of the Treasury Henry Morgenthau Jr. from February 1941 to January 1942, when he joined the Office of War Information. He was with OWI when he was hired by Meyer.

Mr. Barth received many honors. In 1948, he was awarded a Nieman fellowship and studied American history and constitutional law at Harvard University.

In 1957, he was visiting professor of journalism at Montana State University, and in 1958-59, visiting professor of political science at the University of California at Berkeley.

He received awards from the Sidney Hillman Foundation and Sigma Delta Chi, the professional journalism society, which called his editorials "informative, persuasive and written in clean, clear English."

He was cited by the Washington Area Council of the American Veterans Committee, the District branch of the NAACP, the American Newspaper Guild, the Education Writers Association and Americans for Democratic Action.

In 1964, Mr. Barth was presented the first Oliver Wendell Holmes Bill of Rights Award of the National Capital Area Civil Liberties Union.

His awards came for his work in civil rights. But Mr. Barth wrote on other matters too. In 1961, he gave a first-hand account of what it was like when he and 105 other persons aboard a jet airliner had to circle Omaha airport for a lengthy period, preparing to make a crash landing because of a defective landing gear. The plane finally made it to the ground safely.

On another occasion, while walking his dog near his home in Washington, Mr. Barth witnessed a gun slaying. That too produced a first-hand account from him.

Mr. Barth had his light side, which appeared in a number of his signed columns that appeared on the page opposite The Post's editorial page.

"Something comes over the male animal on the day after Christmas," he wrote in 1967. "The spirit of giving gives way suddenly to the spirit of getting. He turns shopper, as every retail merchant, especially the haberdashers, know full well, and he becomes a bargain hunter with the relentless ferocity of a stag who has just harkened to a mating call."

One of his greatest pleasures was the softball team that he and lawyer Joseph Rauh, another civil liberties advocate and close friend, put together for the benefit of their sons. It soon attracted their own friends, and the Barth-Rauh game went on every Sunday afternoon for more than 25 years at the ballfield across the street from Mr. Barth's home in Washington. It was Mr. Barth's game.

He is survived by his wife, Adrienne, of Washington; a son, Andrew, of Columbia, Md.; a daughter, Flora Wolf of Philadelphia, and three grandchildren.

The family suggests that expressions of sympathy be in the form of contributions to the American Civil Liberties Union.