ONE OF THE great tragedies of schoolboy history is the Battle of New Orleans. It was fought, we were all taught, after the treaty ending the war of 1812 had been signed, but the news had not yet reached America. Lots of men were wounded and lots of men died in a battle that, as far as the war was concerned, changed nothing. The whole thing need not have happened.

Maybe years from now schoolchildren in the District of Columbia will study the Great Police Hiring Battle of 1981 and conclude that it was very much like the Battle of New Orleans. This at any rate is the conclusion of Mayor Marion Barry himself. Having triggered the battle, fanned it and finally fought it to the point where he lost hands down in Congress, he has now said that the whole thing was unnecessary.

"If I knew then what I know now, I would have done it differently," said the mayor.

What the mayor was talking about was his plan to hire 200 District police officers by lottery. He suggested this plan last summer after 62 of the top 100 scorers on the police department's entrance examination turned out to be white. It was then that the mayor denounced the examination as racially biased and ordered the police department to hire by lottery. He has since changed his mind.

"I believe leadership should have the right to change its mind, and from time to time I will change mine," said the mayor. But what has really changed is not the mayor's mind, as he said, and not even the facts, but his understanding of them. He never bothered to find out what they were. Instead, he opened a big mouth, insisting to certain audiences that he would never countenance a racially biased hiring process and then thought up one that was just that. The lottery, after all, discriminated against those (mostly whites) who scored well on the test.

The mayor never determined what would happen when the hiring process was completed. It turns out that for one reason or another some 244 of the original 635 applicants are no longer eligible. Some of them failed the physical and some could not pass the background investigation and some just lost interest. At any rate, there are now sufficient blacks at the top to ensure that they will compose a healthy majority of those chosen to be new District of Columbia police officers.

The whole thing might have been unnecessary, as the mayor says, but it was not without its cost. The plan provoked a storm of protest from both the police and firefighters unions and helped kill morale in those two uniformed services. In the end, the police took their case to Congress, giving it yet another opportunity to meddle in District affairs. It wound up prohibiting the city from hiring police officers by lottery.

But much more important, the lottery plan exacerbated racial tensions. It set one race against the other and even, to an extent, one sex against the other. The issue, after all, was only in some academic sense about racial equality. It was really about jobs -- who was going to get them and how they were to be obtained.

There is never a good time for racial conflict, of course, but certainly a recession is a particularly bad time. The city has high unemployment, a sick real estate industry and a commercial building boom that is about to go bust. A lot of people are hurting -- people in the construction trades as well as people who sell real estate. To make matters worse, the local industry -- federal government -- is laying off workers while also ending a whole lot of social programs that both employed people and served them. Things are getting worse and when things get bad, racial tensions rise.

Just how high they rise depends to a great extent on the political leadership. The city is about to plunge into a mayoral campaign in which, for the first time, there is a serious white candidate. The task for all the city's politicians is to get through this period in racial harmony and not to make race an issue when it need not be one. This is the special obligation of the mayor who, after all, sets policy and speaks for the entire city. In the past, he has not done well, but from here on out, there will be no room for the sort of mistake he made on the police hiring plan. Next time, instead of changing his mind, he ought to use it first.