Adm. H. G. Rickover, for 59 years the naval officer and cage rattler, bade farewell to Congress yesterday with the grim warning that the arms race is so far out of control that the human race probably will blow itself up in a nuclear war.

"What difference does it make?" the 82-year-old admiral caustically asked the Joint Economic Committee. "Some new species will come along. They may be wiser."

Declaring that disarmament is the most urgent need of the hour, Rickover challenged the committee to "put me in charge of it. I'll get you some results."

Come midnight Sunday, Rickover is being retired against his will from the Navy and thereby ceases to be the iron-handed skipper of its nuclear propulsion office, which helped put the world's mightiest submarines and warships to sea.

"I'm not proud of the part I played in it," Rickover said in turning reflective. He called those ships and subs "a necessary evil," adding, "I would sink them all" if mutual disarmament could be negotiated.

He said what the world needs is something like the 1921 agreement that reduced naval armaments until Hitler came along in the 1930s and rebuilt the German military. Without disarmament or divine intervention, which Rickover said he does not believe in, "I think probably we'll destroy ourselves."

In the meantime, Rickover prescribed some strong medicine to cure some of the ills of the U.S. military establishment, telling the committee:

"We're spending too much" on defense. "We should be more selective in our spending," adding that he sees no sense in building any more submarines than already authorized. "I see no reason why we have to have just as many as the Russians. What's the difference; we can sink everything they have on the ocean. In general, we are overarming altogether."

"To increase the efficiency of the Defense Department, you'd first have to abolish it and go back to an Army, Navy and Air Force." Even Moses split the Jews in Egypt into groups so he could handle them. "I don't know why we have a Defense Department. I don't know what it does."

If the Defense Department cannot be abolished, Rickover said, the people who are there should be divided into three groups, with one doing the work and the other two writing letters in longhand to each other so they would not get in the way.

"Even Moses wasn't shrewd enough to take care of these claims lawyers" which today represent shipbuilders, so the way to handle a defense contractor who does not perform is "throw him in jail where he belongs." Rickover noted that Peter the Great, after hearing another country's lawyers argue interminably, asked his aide how many lawyers there were in Russia. Told four, the monarch ordered: " 'Go hang the four of them.' "

Reduce the number of admirals and generals and "the staffs that cling around each of them," creating useless paperwork for everybody.

"Phase out the practice" of allowing military officers to retire after 20 years at half pay and keep them in for 30 years.

Give shipbuilders only one year to submit claims for work not covered in the contract.

Build some submarines in government shipyards to provide a yardstick for measuring how well private yards are building subs.

In discussing his future, Rickover said Navy Secretary John F. Lehman Jr. refused his request to move into an office at the Navy Yard and continue to be on active duty as an adviser, while Vice Adm. Kinnaird R. McKee, director of naval warfare, takes over Rickover's old jobs as director of the Navy and civilian nuclear reactor programs. The Navy, in announcing McKee's appointment last night, said he will be promoted to admiral. McKee takes over from Rickover on Monday.

Rickover said Lehman told him last Monday that he will be given an office at the Navy Yard but must be out of it within six months. Rickover earlier had turned down President Reagan's offer to be a consultant on the civilian nuclear power program.

Rickover said he feels fit and ready to continue serving the country to which he came as a 6-year-old immigrant riding from Russia to America in steerage, living off a barrel of salted herring except when passengers threw oranges to him and other children looking up from the bowels of the ship.

Dressed in his usual dark civilian suit and headed toward his usual civilian car, Rickover was asked as he left what he would do now. "Whatever God tells me to," he replied.