Margaret Craig McNamara, 65, who was awarded this country's highest civilian honor, the Presidential Medal of Freedom, last month for her work with Reading Is Fundamental, died of cancer yesterday at her home in Washington.

She was the wife of Robert S. McNamara, president of the World Bank and former secretary of defense in the Kennedy and Johnson administrations.

Mrs. McNamara founded RIF in 1966 and was its national chairman until her death. The program came about this way: She had been serving as a volunteer reading aide in the inner-city schools of Washington when she got the idea that children would be better motivated to read if they could choose their own book and then keep them as their own.

At first an experiment, the idea soon caught on and within a year the program was operating in 61 Washington schools. While launching an early drive to gather paperback books by the thousands for children in poorer neighborhood schools, Mrs. McNamara explained why she had undertaken RIF in this way:

"Many children in Washington have never owned a book. We want to give them that chance and with it the excitement that comes to youngsters when they find that reading can be fun as well as something that is said to be good for them.

"Reading can open a whole new world for a child who previously has known only the life of a dull city block. Most of us forget that a large percentage of the youngsters in our elementary public schools have no books at home nor easy access to public libraries."

Today, RIF operates about 4,400 projects in 50 states, the District of Columbia, Puerto Rico, the Virgin Islands and Guam. It is in libraries, hospitals, day care centers, correctional institutions and many other facilities in addition to schools.

Mrs. McNamara participated in many other civic activities over the years although RIF became the most publicized -- which led then-President Carter to note, in effect, when he presented her the Medal of Freedom as she sat in a wheelchair at the White House on Jan. 15 that she was a prime example of what private citizens can accomplish even though they do not have official responsibilities. He referred to her as a very special person.

Yesterday, Colbert I. King, U.S. executive director of the World Bank, recalled her organizational know-how and personal drive and determination. He said he became one of her soldiers while he was working for the U.S. Senate and that she convinced many members of the Congress that RIF deserved the nation's full and steadfast support.

Ruth Graves, president of RIF, said Mrs. McNamara was a presence there "that was always inspiring."

In 1959, Mrs. McNamara was named regional director for the White House Conference on Children and Youth. She had served in 1979 as a member of the White House Advisory Council on Library and Information Services. She was a member from 1964 to 1968 of the National Advisory Council of the Office of Economic Opportunity and had been active for many years in the League of Women Voters. Mrs. McNamara had been an active volunteer with the Head Start Program and the Widening Horizons program of the Urban Service Corps in Washington.

She was born in Seattle, Wash., and grew up in Alameda, Calif. She graduated from the University of California at Berkeley in 1937 and taught biology and health education in California secondary schools for several years. She was married to Robert S. McNamara in 1940.

Mrs. McNamara was a member of the board of Chatham College in Pittsburgh, the Eugene and Agnes Meyer Foundation, the Harvard Visiting Committee and the University of Michigan Far Eastern Studies Committee. She had received a number of honorary degrees and other honors.

In addition to her husband, who earlier was awarded the Medal of Freedom by President Johnson, she is survived by two daughters, Margaret Pastor and Kathleen, both of Washington; a son, Craig, of Winters, Calif.; a sister, Kay Craig, of San Mateo, Calif., and a grandchild.

A memorial service will be held at 2 p.m. Friday at the National Cathedral here.