W. E. (Obie) O'Brien, 64, a former aide on Capitol Hill for many years, died Sunday in Madison, S.D., after a stroke.

After retiring from government service in 1970, he had returned to his home town of Madison to become executive director of the Karl E. Mundt Foundation at Dakota State College.

Born in Faribault, Minn. Mr. O'Brien graduated from Dakota State College (then known as General Beadle State College) and taught in South Dakota public schools.

He came to Washington in 1939 as administrative assistant to the late Sen. Karl Mundt (R-S.D.), who was then beginning as a member of the House of Representatives.

He remained with Mudnt when the latter was elected to the Senate in 1948. Mr. O'Brien left the senator's staff in 1957 for a six-month assignment as assistant to then Secretary of Agriculture Ezra T. Benson.

Mr. O'Brien returned to Capitol Hill that year as a member of the professional staff of the Senate Committee on Government Operations.

He was cited for his contributions to the Committee's work on legislation dealing with pornographic materials and the problems of population imbalances in parts of this country.

While serving on Capitol Hill Mr. O'Brien attended evening classes at American University and helped establish a chapter there of Sigma Delta Chi, a professional journalism society.

He is survived by his wife, Marjorie Sullivan O'Brien, of the home in Madison: four sons, Steve, of Sioux Falls, S.D., Sean, of Washington and Mark and Brendon, both of Brookings, S.D.: a daughter, Peggy Kinsells of Madison; his mother, Mary O'Brien, and a brother, Cyril, both of Madison, and two sisters. Bonnie Hulshof of Fresno, Calif., and Edith Fitzgerald of Ventura, Calif.

The family suggests that expressions of sympathy may be in the form of contributions to a scholarship fund in Mr. O'Brien's name at the Karl E. Mundt Foundation.