"It's hard but it's fair" is one thing outgoing deputy mayor Elijah B. Rogers likes to say around the District Building. But last night, putting all fairness aside, old friend William Rumsey told about the time Rogers went to Mexico to give the keys to the city to that country's president and opened an empty box.

Nothing big or small about Rogers' life was spared last night at a roast in his honor at the Shoreham, attended by an impressive cross-section of the city's leading movers and shakers.

"Looking around, I'm thinking I should never run against Elijah Rogers," said Mayor Marion Barry. Barry offered the first toast and the first gibe at Rogers' drinking preference. "Get some champagne, I'm not going to toast you with Miller's," ordered the mayor. Rogers hoisted a champagne glass, but at the same time steadfastly held onto his beer glass.

Not one of the 14 people on the dias missed a crack at Rogers' size, which is a solidly packed 5-foot-1. Even in the prayer there was a line, "despite his shortness and other infirmities." Master of ceremonies Rumsey, former director of the city Recreation Department, said, "Rogers has another tailor--J.C. Pennette--but it's not a big job to clothe him."

His thinning hair was another target. "You can't trust a man who combs his hair with a washrag," said Ivanhoe Donaldson, one of the city's three deputy mayors. Remembering the first time he saw Rogers, attorney Arthur Reynolds said, "He was wearing a T-shirt that said, 'God only made a few perfect heads and on the rest of them he put hair.' "

When the mayor's next turn came at the microphone, he was rambling, repetitive and giggling as he joked about how The Washington Post always credited Rogers for successes and blamed Barry for mistakes. "Elijah brought professionalism to the city; the mayor brought politics," Barry said in his paraphrase of news reports. Then he said, "Elijah, you have to get a pass to come back to the District Building. I have instructed my guard not to let you in."

After about 5 minutes, Effi Barry took the outsized hook used to time the speakers and tugged at him. Barry replied, "You're going to suffer for that tonight, baby."

During the mayor's remarks, the crowd of about 1,400 sat silently.

Asked about Barry's remarks, the mayor's press secretary, Annette Samuels, said Barry had had trouble with his eye and had seen a doctor yesterday afternoon. She said she was not sure if the mayor was taking medication. She acknowledged that his "delivery was slow."

Samuels added that "it was very difficult for the mayor to talk about people he cares about. I really think it was the emotion of the thing. We talked this afternoon, and he was very quiet. He was subdued. For him it was quite difficult."

Since he became city administrator in December 1978 and then early this year a deputy mayor, Rogers has been in the thick of every local policy decision and dispute. He is leaving to join an international accounting firm June 1.

In some quarters, Rogers developed a reputation as heavy-handed, arrogant and impatient with anyone not as quick as he. Several times last night he was called a "magician" for coming up with a surplus in the District budget in 1982.

"Can I kiss you?" asked Walter Scheiber, director of the Washington Metropolitan Council of Governments, extending his hand to Rogers.

"In 1971 we ran a program to bring young minorities into city management and Rogers was our first graduate," said Scheiber. "He has a wonderful sense of people. If you doubt that, just look around the room."

On a lot of minds last night was the controversy over the lottery contract for the city's daily numbers game. After one vendor was selected, the mayor appointed a special committee to review the selection process. That commission recommended that the bidding be reopened and it was. The vendor that was originally awarded the contract then filed a $12 million suit that names Rogers and four others, and accuses them of pressuring the lottery board in favor of a more politically connected firm.

But few guests last night thought that Rogers was leaving under a cloud. "There are questions up and down and I haven't reached any conclusions of wrongdoing," said City Council Chairman David Clarke. "I don't think it's a particular cloud over Rogers, his role was minimal. He has been a superb administrator, even though he is strong on executive control."

Even before the roast started, Rogers quipped, "I want to let the mayor know, I play by the numbers."

And among the many gifts he received was a handful of lottery tickets.