BERKELEY, Calif. — To kick off homecoming weekend last fall, the University of California, Berkeley, held a groundbreaking ceremony for its new data sciences building, known as the Gateway. At a cost of over half a billion dollars, the 367,270-square-foot building, with “extended sightlines and natural light-filled corridors,” is being billed as a hub for research in artificial intelligence, data analytics and machine learning.

That may represent the future, but the past is just a short walk across campus in the stacks of the anthropology library. For decades, the repository has served generations of scholars in a space as modest as the Gateway is grand: a 1,500-square-foot corner on the second floor of the anthropology department’s building, with a cozy reading area of armchairs and computer terminals along one wall.

For days now, the library has become a scene of occupation. Students have filled it with tents, sleeping bags and air mattresses in a last-ditch effort to save the 67-year-old institution dedicated to anthropology, which encompasses the study of humanity, societies and cultures. The university is preparing to move the collections of archaeological field notes and books — about 80,000 volumes in total, on subjects as varied as folk tales, Black culture and Mexican American social movements — to a nearby warehouse and the main library, saving $400,000 annually.

For the student occupiers, the fight is as much a battle over a library as it is over humanities and social sciences in an age when the world is obsessed with technology and seems eager to replace the physical world with virtual experiences driven by A.I.

“It’s about fundamentally writing a different story about what education is, what the university is for,” said Jesús Gutiérrez, a graduate student who works at the library and is writing a dissertation about folk art forms of the African diaspora.

In the past five years alone, the number of Berkeley undergraduate students choosing to major in anthropology has dropped by about a quarter, part of a generation that has struggled to pay student loans and flocked toward science and engineering in the lucrative shadow of Silicon Valley.

Faculty members say they’re impressed by the intensity of the young students protesting to save the anthropology library, a cause that otherwise has relied on support from Ralph Nader, the liberal activist and onetime third-party presidential candidate, and Jerry Brown, the former governor of California who majored in classics when he was an undergraduate at U.C. Berkeley more than a half century ago.

As a third-year anthropology student, Ian Molloy, one of the protest organizers, has heard the snickers from classmates pursuing science and engineering majors, framing his subject choice as “Oh, you don’t want to make money.” He called the library, where he has found titles on the domestication of animals vital to his research, the “backbone” of the department, and central to rebuilding community after the isolation of the pandemic.

Despite the outcry, the administration says it is not budging, explaining that the cuts are necessary as it faces an $82 million budget deficit. In March, Carol Christ, the Berkeley chancellor, pointed to raises that the U.C. system had agreed to pay graduate student instructors and support staff as one driver of new costs.

The university has said it will save about $1.5 million by closing not just the anthropology library but the mathematics and physics libraries as well, and cutting hours and services at others.

“We are aware of the protest and are monitoring the situation,” the university said in a statement. “Regarding the anthropology library’s closure, we, too, wish the library could remain open, but that is not an option at this point.”

At 93, Laura Nader remains a prolific scholar and teacher decades after she became the anthropology department’s first woman to gain a tenure-track position, in 1960. “But I couldn’t have done it without the library,” Dr. Nader, Mr. Nader’s sister, said. She worries that students interested in anthropology will instead prefer other universities with dedicated anthropology libraries.

Dr. Nader views the planned closure of the library as another step in the decline of humanities and social sciences generally — and anthropology specifically.

“So all of a sudden it becomes a job question,” she said. “You don’t need anthropology.”

Under the administration’s plan, some of the materials in the library, founded in 1956 and later named for George and Mary Foster, two prominent Berkeley anthropologists, will be moved to a storage center in nearby Richmond, Calif. Other parts of the collection will be dispersed throughout the university’s main library.

Alexander Parra, who is majoring in computer science and Chicano studies and who has been occupying the library, said that one of the things that would be lost if the library closed was the possibility of serendipity — of finding a book you didn’t know you were looking for. When students staged an occupation earlier this year, after the university announced the closure plans in February, Mr. Parra by chance noticed a title about Mexican American youth organizations, a subject he was researching.

“That’s me,” he said. “That’s me in that book.”

Some students and professors also see the fight as an equity issue. Among those majoring in anthropology, 43 percent of students are from underrepresented minority groups, compared with 5 percent for computer science. The library also serves those majoring in Chicano studies and African American studies, disciplines that likewise have a higher share of unrepresented minority students.

Mr. Brown, who once taught a course in Berkeley’s anthropology department, has reached out to members of the University of California Board of Regents, urging it to spare the library.

“Great and capacious minds have graced that building,” he wrote in an email to the board chairman. “To replace it now, even in part, by a mere warehouse in Richmond is beyond the pale.”

Charles Hirschkind, the chair of the anthropology department, said that the university had reduced the number of graduate students it accepts into the anthropology since 2004 by a little more than half, reflecting, he said, the department’s “weaker financial situation” and the rise in costs to support graduate students.

“When we’re talking about budgetary restraints, we are also talking about priorities and where one decides to invest,” he said. “And I think the university feels little incentive to invest in the social sciences and humanities.”

Dr. Hirschkind said some faculty members had been pleasantly surprised to see the younger generation fighting for the library after assuming students that grew up in the digital age might have less appreciation for physical books or the pleasures of a library. And the occupation of the library, to some, is reminiscent of an earlier activist era at Berkeley.

“There is a strong sense of communitas in the air — it is not at all like identity politics — we need a new word for it,” Nancy Scheper-Hughes, an anthropology professor, wrote in an email to Mr. Brown. “They want to read. They want to be with open communities of people of very different ideas.”

The students, meanwhile, have been living in the library for more than a week, studying for finals, playing board games and eating breakfasts of croissants and granola. Worried that the university is trying to run out the clock until summer break and then dismantle the library, the students say they will stay as long as it takes.

“They can give us the library tomorrow,” Mr. Molloy said, “and we’ll all be happy to go home.”