NEW YORK, JAN. 1 -- Imagine a school system where janitors control the buildings and sometimes refuse to admit teachers and students.

Imagine a system in which classrooms have gone unpainted for 60 years, one-fourth of the buildings have broken roofs and some have no working toilets or drinkable water.

Imagine a system in which six of 10 students fail to graduate from high school after four years.

Imagine a system in which the school board is accountable to no one and sits atop a massive bureaucracy that its president describes as "chaotic," "unresponsive" and "the Kremlin's counterpart in the western world."

If this seems difficult to visualize, it is all here in New York City's public schools, the center of a political quagmire so deep that the state's two top officeholders, Gov. Mario M. Cuomo (D) and Mayor Edward I. Koch (D), have been unable to push through even modest reforms.

After a five-month search, this intractable mess is about to be dropped into the lap of one of several finalists for the job of New York schools chancellor. The city has never had a black chancellor, and there is considerable pressure on the school board to choose one of two black candidates: Richard Green, superintendent of schools in Minneapolis, or Bernard Gifford, dean of graduate education at the University of California at Berkeley.

Failure to conclude the search by this weekend, when outgoing chancellor Nathan Quinones planned to leave, was an embarrassment that highlighted the board's fragmentation.

Two of its members are chosen by the mayor and five by the borough presidents, and the latter faction staged a last-minute revolt that forced the board to add Gifford, a favorite of the United Federation of Teachers, to the three finalists chosen by its blue-ribbon search panel.

The dissident members argued that Gifford, a deputy chancellor here in the mid-1970s, is the only top candidate with experience in the nation's largest school system. But after a series of mediocre chancellors who came up through the ranks, school board President Robert F. Wagner Jr., a Koch confidant, said he was determined to find a strong leader from anywhere in the country.

Such infighting led several prominent educators to refuse to be considered for the $150,000 post. They included D.C. schools superintendent Floretta McKenzie and Fairfax County Superintendent Robert R. Spillane.

"While the rest of the country was going through school reform, New York was not," said Donna Shalala, former president of Hunter College and now chancellor of the University of Wisconsin. "Things just slid too far. Teachers have little control over what goes on in the classroom, and principals have little control over personnel or their own buildings."

The long slide began in the 1960s as middle-class families abandoned the system in droves and the student population became more than 70 percent black and Hispanic. But in the last year, crosscutting pressures from businessmen, parents and civic groups have pushed public education onto the front pages.

The city has no monopoly on decaying urban schools. New Jersey Gov. Thomas H. Kean, for example, is moving toward a state takeover of failing school districts such as Jersey City. But with nearly 1 million students in 1,050 schools -- and a $5 billion budget, twice as large as that of the entire D.C. government -- New York's education problems seem wrought on a larger scale.

Richard Beattie, who recently resigned from the board of education, said he was "terribly frustrated" to learn that New York is one of a handful of cities in which principals have life tenure.

"How can you manage and operate a system," he asked, "when you can't take a good principal and move him to a bad school? The system is so loaded down with rules and regulations. There is no management system. We talked about getting a handle on the problem of homeless kids in hotels and getting them into schools and, a year later, nothing has been done."

City Council President Andrew Stein, who investigated the board's contract with the 986-member custodians' union, recalled a recent visit to a Bronx junior high school. "The bathroom is disgusting, the ceiling's falling down, it's freezing in some classrooms and over 100 degrees in others," he said.

Stein describes the custodians' contract as "legalized extortion." The custodians function as independent contractors and have virtual control over operation of school buildings.

When teachers at one Queens elementary school tried to enter the school to prepare lessons before 8 a.m., Stein found, the custodians retaliated by locking the doors. The custodians later agreed to open the school early in exchange for $10,000 a year in "opening fees."

The union charges similar fees to keep schools open for student activities after 3 p.m., in one case billing for the use of an empty auditorium where a Girl Scout troop stored coats, Stein found.

Wagner, son of a former mayor, has called for abolition of the board. This political fragmentation was highlighted when Koch failed to persuade the Bronx representative to step down for a Hispanic replacement and was reduced to urging that the man's house be picketed.

Koch and Cuomo have united on a proposal to give the mayor sole authority to appoint the school board. "No one is perceived as being accountable," Cuomo said recently. "The mayor's not in charge, the governor's not in charge . . . . Who do you put the heat on?"

The sense of crisis has been building since Quinones resigned under fire last August, saying he would stay until Jan. 1. His departure came shortly after Time Inc. and CBS Magazines withdrew from an experimental high school program, citing ineptitude on the part of the board.

"The business community is all over them now," Shalala said. "They don't see much of a future in a work force that's increasingly unskilled and illiterate."

Even hiring teachers is complicated in New York, which needs to recruit 40,000 new ones by 1994. All applicants must submit to Board of Examiners testing, which takes as long as five years and duplicates tests at the state level. The result is that 85 percent of teachers enter the system as "temporaries" with lower pay and benefits than fully certified teachers.

"We only hire people who have very high endurance levels or can't possibly get another job," said Robin Willner, director of the Educational Priorities Panel, a watchdog group. "It's like an obstacle course to get a job here. You're treated like you're in a cattle call."

The bureaucracy, which employs 122,000 people, has so stifled innovation and efficiency that some exasperated teachers are said to have spent their own money on pencils, erasers and chalk.

A second layer of 32 elected community school boards, a product of the 1960s battle over decentralization, has been assailed for cronyism and political favoritism.

All of this has taken a toll. School officials recently tracked 70,000 high school students over a four-year span ending in June 1986. Only 41 percent were found to have graduated on time. Twenty-two percent dropped out, with most never progressing beyond 10th grade.

Another 21 percent remained enrolled for a fifth year, but many were absent so often that they were only "marginally involved" in school. Twelve percent moved to other cities or schools, and the status of 4 percent was unknown.

No better metaphor exists for the decline of public education here than the decrepit state of school buildings. Recent reports say one-fourth of them have inadequate lighting or poor heating and plumbing. The Bronx High School of Science opened the year with 150 broken windows, and a Brooklyn high school was ordered closed after a judge found it "literally dripping with dangerous asbestos."

Although dozens of new buildings are needed, the school board has been unable to complete a new high school in fewer than eight to 10 years. The last new high school was finished behind schedule in the early 1980s and suffers from serious design flaws.

Cuomo recently convened an education "summit" to push his proposals for a mayorally appointed school board, a new school construction agency, abolition of the Board of Examiners and an end to tenure for principals. But the package remains stalled in the state legislature, where some out-of-town lawmakers are loath to cede more power to Koch.

"Once you have to go to Albany, you've got every local politician who has their own view about this," Beattie said. "The parents are spread out over 32 community school districts, and they have not been able to coalesce into a forceful group for change."