It wasn't supposed to have happened. Thirty-two years in political office, Sen. Jacob Javits was considered a shooin to win the Republican primary; his opponent, an arch-conservative from a Long Island town, a neophyte.

But late tonight, in the culmination of an increasingly bitter election, Javits for the first time in his long political career, had to face failure. At 11 p.m. he conceded the primary to Alfonse D'Amato, a supervisor from the town of Hempstead. But he did not concede defeat.

"The Republican Party of New York has made its choice as a party and recriminations on that score are not in order," he said. "It has been said that defeat is a healthy experience. I have had my political victories in the past four years for which I am deeply grateful to the voters. I take this experience as I have taken every other in life -- as a means of learning and as an incentive to do better rather than as a repudiation."

His spirits seemed good, though his face had been somber as he had approached the speaker's platform at the election headquarters at Manhattan's Roosevelt Hotel. Flanked by his wife, Marion and his daughter, Joy -- one of his three children -- Javits smiled often and several times was forced to stop his prepared statement because of thunderous applause. And while it had been rumored in the last difficult days of his campaign that he might retire from politics if he lost this race, he indicated the opposite.

He insisted he would continue as the nominee of the Liberal Party.

"Voters all over America are complaining about the lack of choices in this 1980 election year," he said. "I can't speak for the other states, but the voters in New York state are going to have a choice in this year's Senate race. I'm a candidate for the U.S. Senate on the Liberal Party line and I intended to campaign vigorously and aggressively and I expected to win and I expect to continue my service to my state and the nation for the next "six years."

Javits' defeat came at the hands of the 43-year-old D'aMato, a man who is his political opposite. While Javits ran this primary with the support of the liberals as well as the Republicans, D'Amato was the choice of the Right-to-Life Party as well as the Conservative Party -- so that, win or lose, he, too, would have been on the ballot this November.

On the issues they were repeatedly at odds, Javits favors abortion rights and the Equal Rights Amendment while D'Amato does not; D'Amato supports the entire Republican national platform while Javits has not supported its position on ERA; Javits favors full health care insurance, while D'Aamto favors it only for catastrophic illness and claims that Javits helped make New York "the Cadillac of welfare states."

But three was another more bitter -- and possibly more damaging -- issue in this campaign: the issue of Javits' health. At the moment he announced his candidacy last winter, Javits disclosed that he has motor neuron disease, a chronic condition, usually progressive, that damages nerves, finally causing muscles to wither.

D'Amato, in commercials some political observers deemed unruly harsh, attacked Javits on grounds of his health. "Now 76 and in failing health, he wants six more years?" said one commercial, shown over a crumpled and unattractive photo of the senator. That campaign may have taken its toll. aAn ABC voter exit poll taken today indicated that one third of Republican voters cited age and health as reason to vote against Javits.

Speaking this evening, however, Javits insists in answering questions from reporters that he felt no bitterness for D'Amato. He also shied away from specifics when asked about the causes for his defeat.

"I believe what contributed to defeat was the fact that I wasn't up to the mark campaigning -- the fact that I didn't bring my fantastic record before the people. But the election law now gives me another chance."

As to whether he felt sad in this, his first defeat, he insisted he did not.

"I asked the voters to come out and decide and they did . . . I wish more had come out. I felt we would have a better chance if they had . . . But two of the nice things are that the Lord has given me another chance . . . and to know I'm still your favorite candidate."