Herbert W. Beaser, 66, former legislative assistant to the late Sen. Ernest Gruening (D-Alaska), died Friday in his Silver Spring home after a heart attack.

Mr. Beaser joined Sen. Gruening in 1958 and remained as legislative assistant until the senator's defeat for reelection in 1968. Mr. Beaser was coauthor with Sen. Gruening of a 1968 book, "Vietnam Folly."

Since 1968, Mr. Beaser had practiced law and worked as a consultant to the Department of Health, Education and Welfare. He helped direct studies for HEW during the 1970s on the legal status of runaway children and on mid-wifery.

He came to Washington and began his government career in the early 1940s. He served as chief counsel of both the U.S. Children's Bureau and the U.S. Office of Vocational Rehabilitation in the old Federal Security Agency.

He worked as chief counsel to the Senate Juvenile Delinquency Subcommittee for a year before becoming legislative assistant to Sen. Herbert H. Lehman (D-N.Y.) in 1955. Mr. Beaser later was administrative assistant to Rep. Edith Green (D-Ore.) before joining Sen. Gruening's staff.

He was the author of a number of publications on youth welfare problems, foreign aid, and populations control.

He served as an adviser to Eleanor Roosevelt when she served as a U.S. representative at the United Nations.

Mr. Beaser was a native of Boston. He earned bachelor's and law degrees at Harvard University, and worked in the office of the Attorney General of Massachusetts before coming to Washington.

His wife, Bernice, died in October 1978.

He is survived by two sons, Lawrence Jay, of Philadelphia, and Ray Allen, of Gaithersburg; a brother, Dr. Samuel, of Newton, Mass.; and one grandchild. CAPTION: Picture, HERBERT W. BEASER