James L. Farmer, 79, the founder of the Congress of Racial Equality and the moving force behind some of the most dramatic episodes of the civil rights era of the 1960s, died yesterday at a hospital in Fredericksburg, Va.

No further details were available, but Mr. Farmer had diabetes, which led to the amputation of his legs.

Mr. Farmer was a preacher by training, a pacifist by conviction and a union organizer by profession. In the Nixon administration, he served as an assistant secretary in what is now the Department of Health and Human Services. He also was an author and lecturer. In later life, despite his ailments and the loss of his eyesight, he became one of the most popular professors in the history of Mary Washington College in Fredericksburg.

As a civil rights leader during some of the peak years of the movement, Mr. Farmer was one of the "Big Four," ranked with the Rev. Martin Luther King Jr., the head of the Southern Christian Leadership Conference; Whitney Young, executive director of the National Urban League; and Roy Wilkins, of the NAACP.

The moral foundation of his career was a belief in "the beloved community" envisioned by King, an integrated society in which all races share a sense of humanity and justice. His means for achieving it was nonviolent protest in the manner of Mohandas K. Gandhi, leader of India's struggle for independence.

Although most of his work was in the mean and dangerous streets of a segregated America, Mr. Farmer became a familiar figure in the corridors of power -- he claimed credit for suggesting to President Lyndon B. Johnson the outlines of affirmative action, a centerpiece of Johnson's Great Society program.

In 1961, Mr. Farmer won national attention by organizing a Freedom Ride from Washington to Jackson, Miss. He and a dozen companions challenged a reluctant federal government to enforce Supreme Court decisions outlawing segregation in interstate bus facilities.

The episode was a defining moment. Television carried unforgettable images of a burning bus and of racist mobs attacking peaceful demonstrators. Volunteers flocked to the South. Pressure mounted to dismantle Jim Crow laws. Unable to remain on the sidelines, the Kennedy administration joined the struggle, and ultimately the infamous "white" and "colored" signs that labeled terminal facilities went down.

In January 1998, President Clinton awarded Mr. Farmer the Medal of Freedom, the nation's highest civilian honor.

Mr. Farmer started CORE in 1942 with an interracial group of students at the University of Chicago. Applying Gandhian principles, its volunteers would "substitute bodies for exhortation" in fighting racial prejudice, in Mr. Farmer's words.

CORE members sat at tables at a segregated Chicago restaurant and insisted on being served. Mr. Farmer believed this was the first of the civil rights sit-ins. Over the years, CORE, a thoroughly integrated group, targeted barbershops, swimming pools, community centers and housing developments. There were voter registration drives.

In 1947, CORE moved into the South with a freedom ride called a "Journey of Reconciliation." Sixteen CORE members set out to test enforcement of a Supreme Court ruling that desegregated seating on interstate buses. Mr. Farmer, busy with union work, was unable to take part. The group was arrested in North Carolina.

Mr. Farmer used to say that "the NAACP is the Justice Department, the Urban League is the State Department and we are the nonviolent Marines." This was the organization he mobilized for the Freedom Ride in 1961. The idea, Mr. Farmer explained, was to have an interracial group ride through the South, whites in the back of the bus, blacks in front, all refusing to move when ordered.

Mr. Farmer was confident the response would force a showdown. A mob attacked the riders and burned a bus soon after they entered Alabama. In Montgomery, Ala., a mob threatened to break into a church where the Freedom Riders were meeting.

King, who had come to offer support, described the situation to Attorney General Robert F. Kennedy. Kennedy suggested a "cooling-off" period. Mr. Farmer was outraged. He remarked: "We have been cooling off for 350 years. If we cool off any more, we will be in a deep freeze. The Freedom Ride will go on." King relayed this to Kennedy, who then persuaded Alabama and Mississippi authorities to provide protection, and the ride went on.

In Jackson, Miss., the protesters were arrested as they entered a segregated restaurant in the terminal. Refusing to make bond, they spent the next 40 days at the Parchman Prison Farm. Over the summer, hundreds of volunteers tried to integrate the same restaurant and were also arrested.

By the time the federal government banned racially designated travel facilities, the civil rights movement had gained momentum that carried over to areas such as voter registration.

Although based in New York, Mr. Farmer frequently returned to the front lines in the South. In the summer of 1963, he was jailed in Plaquemine, La., after leading a demonstration against police brutality. Released, he was surrounded by a mob. Warned that he would be killed if he showed himself, he took refuge in a mortuary and escaped by hiding in the back of a hearse. The episode kept him from the famous 1963 March on Washington.

In 1964, three volunteers in a CORE-sponsored voter registration drive in Mississippi, Michael Schwerner and Andrew Goodman, both white New Yorkers, and James Chaney, a black from Mississippi, were murdered by Ku Klux Klansmen.

"If any man says that he had no fear in the action of the sixties, he is a liar. Or without imagination," Mr. Farmer wrote in his autobiography.

By the end of 1965, Mr. Farmer had decided to step down as national director of CORE. He believed that passage of the Voting Rights Act of 1965 largely completed the guaranteeing of the legal rights of citizenship to blacks.

Another reason was that CORE, like other civil rights groups, was increasingly under the sway of younger black separatists, and whites were being purged from CORE chapters despite its tradition of inclusion.

Mr. Farmer sensed the waning of his influence. While believing that many activities of CORE chapters in the northern ghettoes would alienate rather than attract, he could do little to stop them. Some CORE members called him insufficiently "black," noting that his wife, the former Lula A. Peterson, was white.

At CORE's 1966 convention, Mr. Farmer declined to run; Floyd McKissick succeeded him as national director. Afterward, he was listed as chairman of a CORE advisory committee, but in 1976, he cut his ties over efforts by Roy Innis, then the director, to recruit black Americans to fight in Africa.

Mr. Farmer believed his views cost him a place as a leading spokesman for African American concerns, but he never lost his faith in a colorblind society. In the 1960s, he rejected the militant separatism of Malcolm X, although the two became friends, and in the 1990s, he scorned Louis Farrakhan, the Black Muslim leader.

"I don't see any future for the nation without integration," he said in a 1997 interview. "Our lives are intertwined, our work is intertwined, our education is intertwined. There's no way we can say we are a separate people, they are a separate people."

James Leonard Farmer Jr. was born on Jan. 12, 1920, in Marshall, Tex,, where his father was a Methodist minister and a professor of theology at all-black Wiley College.

When Mr. Farmer was 6 months old, the family moved to Holly Springs, Miss., where his father joined the faculty of Rust College, another black school. In Holly Springs, Mr. Farmer first encountered Jim Crow. He often told how when he was 3 years old his mother had to explain that she could not buy him a drugstore soft drink. It set the course of his life, he said.

Mr. Farmer graduated from Wiley in 1938 and studied for the ministry at Howard University. One of his professors, Howard Thurman, introduced him to Gandhi's teachings. He graduated from the College of Divinity in 1941 but declined Methodist ordination because the church was then segregated. During World War II, he registered as a conscientious objector, citing the military's racial policies as one reason. The other was his conviction that war was immoral.

During the war, Mr. Farmer was race relations secretary for the Fellowship of Reconciliation, an interdenominational pacifist group. In 1945, he began union work as an organizer for the Upholsterers International Union. Later, he was a representative of the American Federation of State, County and Municipal Employees.

In 1959, the National Association for the Advancement of Colored People recruited him because of his expertise in peaceful protest, but his heart was always with CORE. When black college students began the sit-in movement at a Woolworth's lunch counter in Greensboro, N.C., on Feb. 1, 1960, he had CORE send help. Early in 1961, he was named CORE's first national director.

When he left CORE, Mr. Farmer taught at Lincoln University and New York University. In 1968, he lost a race for the U.S. House of Representatives to Shirley Chisholm (D-N.Y.). Later, the new president, Richard M. Nixon, made him an assistant secretary in what was then the Department of Health, Education and Welfare, where he served in 1969 and 1970. He had special responsibilities for increasing the role of minorities in the agency.

In the early 1970s, he ran an educational think tank. In 1976, he was named executive director of a coalition of public employee unions, serving in that job until the organization was discontinued in the early 1980s. He then moved from Washington to a farm near Fredericksburg and began writing his autobiography.

He began teaching at Mary Washington in 1985. At one time, his course drew 500 students a year from a student body of 3,700. Health forced him to cut back, but he continued to teach into the spring of 1998.

In May 1997, a Fredericksburg City Council resolution honored his life's work, and Spotsylvania County named the library of its new high school after him. Mr. Farmer also received 23 honorary degrees from colleges and universities.

His marriage to Winnie Christie ended in divorce. Lula Peterson, whom he married in 1949, died in 1977. Survivors include two daughters from his second marriage, Tami Lynn Farmer Gonzalez of Spotsylvania and Abbey Lee Farmer Levin of Darnestown, and a grandchild.

CAPTION: Farmer received the Presidential Medal of Freedom last year.

CAPTION: James L. Farmer, center, leaves the courthouse in Plaquemine, La., where he was arrested while leading a demonstration against police brutality.