Peter Stapelton Ridley Jr., 40, an attorney in Washington since 1970, died Saturday at Arlington Hospital after a heart attack.

He entered the private general practice of law after graduating from American University where he had received an achievement award from the Student Bar Association.

A native Washingtonian, Mr. Ridley, was a graduate of Banneker Junior High School and Dunbar High School. He earned a degree in business administration from West Virginia State College in 1960.

He then served for seven years in the U.S. Army, where he attained the rank of captain. He was a company commander and battalion executive officer in Heidelberg, West Germany, and later a military advisor to the South Vietnamese in Ben Tre, Vietnam. His decorations included the Bronze Star.

Mr. Ridley, who lived in Washington, had served on the Advisory Commission for the Codification of the D.C. Municipal Code. He was counsel to the National Rifle Association.

He was a member of the Washington and American Bar Associations, the Northeastern Presbyterian Church and the Brookland Civic Association. t

He is survived by his wife, the former Madlyn June White, and a son Patrick Stapelton, of Washington, and his parents Peter S. and Virginia Pair Ridley Sr., also of Washington.

The family suggests that expressions of sympathy be in the form of contributions to the American Heart Association.