The D.C. school board will go to court this morning in a last-minute effort to save Sumner School, a historic, but deteriorating building at 17th and M Streets NW.

The District's Department of General Services notified the school board yesterday afternoon that the school, built in 1871 for the children of Washington's freed slaves, was "imminently dangerous and unsafe and should be razed" within 24 hours.

Attorneys for the school board will go to Superior Court this morning, seeking a restraining order that would halt the demolition of the school until an independent structural engineer can examine the building.

The school had been deteriorating rapidly since it was vacated in June 1978. Heavy rains last week caused the north portion of its roof to collapse, and structural engineers who have inspected the building said both the north and west walls are in danger of falling at any time.

"Because the roof has been leaking for 20 years, the whole upper section of the structure is rotted away," said Charles Bowers, acting supervisor of the Building and Inspection Office of the D.C. Department of Housing and Community Services.

"We crawled up . . . and found that the beams and the brick walls are dry-rotted," Bowers said, "I took a stick and pushed it six inches into a wooden, 4-by-14 inch beam. The building is so rotten that a strong wind could knock the west wall into 17th Street."

Alaire B. Rieffel, the Ward 2 school board representative said yesterday "It would be a crime to tear it down completely. It's a glorious old building, one rich in history. Every effort should be made to save it."

While the school board is responsible for maintaining school buildings and grounds, the District government has the right of disposition on all such properties.

Rieffel said the board wants to see only the roof and top floor of the building torn down and rebuilt, and the red brick, Victorian school house renovated.

But Donald Croll, chief of real estate acquisition for the General Services Department, said, "Unless you have $3-5 million ready to restore the school -- and we don't -- it would be unfeasible to renovate the building."

Croll said that three independent estimates concluded that the building was "so rotted at this point that it would require an extensive study" -- at a cost of $260,000 to $380,080 -- just to find if it was even feasible to remove the roof and top floors and rebuild the structure "brick by brick."

"Even if we did do a partial demolition, it still could collapse," he said.

David Huie, director of the Board of Education's Building and Grounds Division, acknowledged that the school "had been neglected in the sense that it is an empty building and all our funds have been directed toward the upkeep of the ones in use."

He said that on Sept. 19, however, $50,000 was placed in an account for the purpose of "renovating the building as much as the $50,000 would cover." But no estimates for renovation have been sought, he said.

Huie said that one problem the school has faced in recent times was the "mixing of perceptions of politics and safety."

The school is on a list of 10 buildings -- six of them schools -- that Mayor Marion Barry said Monday he wants to sell to help finance the District's fiscal 1981 budget.

A Washington commercial real estate developer estimated yesterday that the 13,181-square-foot plot, located in the heart of the downtown office district, could bring $1.5 million to the city if sold under the land's current special purpose zoning and up to $3.5 million if rezoned for commercial use.

The Sumner School has not been used since 1978, when the school board evicted the Hawthorne School, a private secondary school that used the building rent-free for six years in exchange for maintaining the structure and enrolling 40 District students tuition-free.

It was the first school in the District built exclusively for black students."It is the most important building for blacks in the District," said School Board employe and historian Richard Hurlbut.

The school, which was placed on the D.C. inventory of historic sites last year, originally housed elementary students and later became the first high school for blacks in Washington.

The building was named for Charles Sumner, a U.S. senator from Massachusetts who, before the Civil War, called for freeing slaves and establishing integrated schools.