Gordon Gray, 73, the national security adviser to President Dwight D. Eisenhower from 1958 to 1961 and a former secretary of the Army and president of the University of North Carolina, died of cancer yesterday at his home in Washington.

Mr. Gray was born to wealth, educated in a classic mold, trained for the law and given to business. Although he kept up his business interests throughout his life, much of his career was devoted to public service. It was often observed of him that in seven years he went from the rank of private in the Army to secretary of the Army. It also was widely noted that he was guided by neither fear nor favor in his dealings in government.

The most visible posts he held were quintessentially involved with national security. But he gave many years to other aspects of government, including the affairs of Washington. From 1962 to 1973, he was president of the National Trust for Historic Preservation. In 1966, he played a role in the passage of the Historic Preservation Act. In 1962 and 1963, he was president of the Federal City Council.

In accepting that post, he said the council should work for broad national support for a larger federal payment to Washington for municipal services. He also said the council should assign "top-priority rating to working for cultural and esthetic objectives in the nation's capital."

Mr. Gray was born in Baltimore. His father, a president and chairman of the R. J. Reynolds Tobacco Co., moved the family to Winston-Salem, N.C. The young Gray graduated from the University of North Carolina, where he was elected to Phi Beta Kappa, and Yale Law School, where he was an editor of the Law Journal and a member of the Coif.

He practiced law in New York and then in Winston-Salem. In 1938, he acquired control of the Piedmont Publishing Co., publishers of The Winston-Salem Journal and the Twin City Sentinel. He also was elected to the North Carolina state senate.

In World War II, he declined a commission in the Army and enlisted as a private. He eventually became a captain in military intelligence with the 12th Army Group of Gen. Omar N. Bradley in Europe.

In 1947, he was named assistant secretary of the Army by President Harry S. Truman. In 1949, after a period as undersecretary, he was promoted to secretary.

In 1950, he was appointed president of the University of North Carolina. While holding that office, he carried out a number of tasks for the White House, including a report on foreign economic policy. In 1951, he was made the first director of the Psychological Strategy Board.

In 1954, he chaired a Personnel Security Board that recommended that the Atomic Energy Commission remove the security clearance of J. Robert Oppenheimer, the noted physicist who played a major role in the development of the atomic bomb in World War II. Mr. Gray said that while Oppenheimer undoubtedly was a loyal citizen he had violated the AEC's security procedures. This action was in keeping with the security concerns of those times. But many who opposed the strident anti-communism exemplified by the late Sen. Joseph R. McCarthy (R-Wis.) were harshly critical of the action.

In 1955, Mr. Gray resigned from the University of North Carolina to become assistant secretary of Defense for international security affairs. He later was director of the Office of Defense Mobilization. Eisenhower appointed him national security adviser in 1958 and he continued in that job until the inauguration of President John F. Kennedy on Jan. 20, 1961.

Mr. Gray then returned to his business interests. He was president of Piedmont Publishing until 1969, when the company became Summit Communications. The firm operates broadcast properties and cable television systems and Mr. Gray was its chairman until his death. He was a director of R. J. Reynolds Industries, Media General Inc. and the American Security & Trust Co. He also was the president of Kensington Orchids, a large supplier of orchids to the Washington market.

Mr. Gray was a member of the Foreign Intelligence Advisory Board from 1961 to 1976. He was a trustee of the Brookings Institution and chairman of the Corcoran Gallery of Art in Washington and the Research Triangle Foundation in North Carolina.

His first wife, the former Jane Henderson Boyden Craige, died in 1953.

Survivors include his wife, Nancy of Washington; four sons by his first marriage, Gordon Jr. of New York City, Burton Craige of McLean, C. Boyden of Washington, and Bernard of Winston-Salem; two stepdaughters, Alexandra Beebe Wright of Winston-Salem, and Schuyler Beebe of Washington, and four grandchildren.