It was the stuff of which show-biz legends are made - sudden injury to a star, a performance stopped mid-stream, frantic phone calls in a search for a replacement, last minute substitutions and the show going on "trouper" style to eventual triumph and rejoicing.

In fact, when ballerina Martine van Hamel fell during Saturday night's performance by American Ballet Theatre of Mikhail Baryshnikov's new production of "Don Quixote" at the Kennedy Center this weekend, everyone got more than they bargained for.

Van Hamel, who had made a splendid debut the night before as Kitri, the female lead of the ballet, sustained a freak hip injury (her presentcondition is decribed as "good") that will keep her out of action for weeks.

The audience, which had expected to see Van Hamel and John Meehan as Kitri and Basil, instead watched delightedly as Baryshnikov himself and Gelsey Kirkland took over, even though they had finished the matinee performance only a few hours earlier.

And Cynthia Gregory, originally scheduled to make her debut as Kitri Thursday night with a different partner, flew in from New York to join John Meehan in yesterday's matinee, which Van Hamel was slated to dance again, to an equally ecstatic audience.

The saga began Saturday night about 10 minutes into the performance of "Don Quixote," which had its world premiere in a gala evening at the Kennedy Center on Thursday. It was reported afterward by an ABT spokesman that Van Hamel thought she pulled a muscle slightly during her entering solo.

She continued dancing, but in the pas de deux with guiter that follows soon afterward, her right leg caved in after a big rearward jump and she fell, bruising her hip. She rose and danced another dozen measures or so, but then crumpled again. Meehan lifted her, but it was clear she couldn't proceed, and she hoped off stage on one foot.

By this time, there was considerable confusion on stage, the dancers not quite sure how or whether to continue. There'd been a loud yelp from the audience at Van Hamel's fall, which apparently could be heard as a distinct thud even by standees at the back of the Opera House, and there was also a burst of applause when she left the stage. Meehan went on dancing briefly and took a scarcely noticed, slight spill of his own, shortly after which the curtain rang down.

There were groans of dismay when an intermission was announced, but after about 40 suspenseful minutes, the announcer returned. He could scarcely get through the words.

"Although they danced the afternoon performance . . . "without yet naming Baryshnikov and Kirkland, before pandemonium broke out.

When Van Hamel took her spill, Baryshnikov was seated in the audience after finishing the matinee with Kirkland around 4:30. Kirkland was a block away, having dinner in the Watergate Hotel restaurant - and still wearing her makeup from the matinee. Once they were backstage at the Opera House, the pair decided that since they were going to do the ballet, they should do it whole. When the curtain rose once more at about 9:10 p.m., the performance started over from the beginning.

Cheers, shouts and tremendous applause greeted the end of the performance, sparked in part by the audience's knowledge that Baryshnikov and Kirkland had danced their extremely taxing roles twice in the same day.

That feat could hardly be repeated, however, so the company next faced the decision of whom to call on to stand in for van Hamel at yesterday's matinee. Baryshnikov and Kirkland already were slated to dance the evening performance again. Cynthia Gregory, the remaining of the three ballerinas who were to rotate as Kitri, was out of town, and Yoko Ichino, an ABT solist who was the only other dancer at all familar with the role, was unavailable due to an injury.

After reprated calls, Gregory was reached in New York in the wee hours of Sunday morning. She immediately agreed to go on, even though she had not yet fully assimilated the role, and had never danced with John Meehan. Joans Kage, the ABT principal with whom she was scheduled to make her "Don Quixote" debut on Thursday, was dancing a guest engagement in Monte Carlo.

At matinee curtain time yesterday, Kennedy Center executive director Martin Feinstein appeared on stage to explain the situation to the audience.

Recounting Van Hamel's unluckly accident, he said, "Up until 10 minutes ago we didn't know if the company would be able to give a performance at all." But Cynthia Gregory had been found, he said, and flew in early Sunday to begin rehearsal. There had not been sufficient time for preparations and warm-up, he noted, so that at that very moment, Gregory and Meehan were still downstairs trying to catch up, and the start of the performance would have to be delayed about an hour and 15 minutes.

in the meantime, Feinstein announced, there would be an ad hoc "symposium," in which he, conductors John Lanchberry and Patrick Flynn, Jurgen Schnelder, an ABT ballet master, and dancers Cynthia Harvey and Victor Barbee from the "Don Quixote" cast would discuss the new production and its musical score.

Gregory's debut, when it came, was as brilliant as might have been predicted, her dancing exhibiting that special clarity , incisiveness and dash that are her trademarks. A few relatively minor adjustments were made in the production to accommodate the exigencies of the occasion - Meehan and Gregory, for instance, each omitted a solo variation. The crowd gave them a standing ovation, and Feinstein presented Gregory with a dozen roses and a kiss during the curtain calls.

After her stage exit Saturday night, Van Hamel had been taken by ambulance to the emergency room of George Washington University Hospital, where she was X-rayed twice and examined by four physicians. The provisional diagnosis was that she had ruptured a major gluteal muscle - apparently a very unusual sort of injury.

She was released from the hospital around midnight and returned to her hotel. As of yesterday afternoon, the report was that she was not in very great pain, but could not stand on her right leg.

It was expected that she would return to new York today, where she will consult several specialists, but she probably will be unable to begin dancing again for three to five weeks.

Van Hamel had been scheduled to dance frequently during ABT's forth-coming spring season at the Metropolitan Opera, beginning April 17, and to appear again as Kitri in "Don Quixote" after the production's New York premiere May 2. Company spokesmen held out the hope she might be able to resume appearances for part of the Met season, which lasts until June 10.

Van Hamel, who has a record of never missing performances, was reported as saying, "You know, I never get injuried, but trust me, if I had to have one, to make it a super freaky thing."

An ABT representative also noted that the company had never once canceled a performance in 38 years of the organization's history, but that this weekend's incident was the closest it had come.

Performances of "Don Quixote" will continue through April 2. Baryshnikov and Kirkland are scheduled to appear, after last night, on Wednesday and Friday evenings and in the Sunday matinee; Gregory and Jonas Kage on Thursday, Saturday and Sunday evenings. Who would replace Van Hamel and Meehan for the Tuesday evening and Saturday matinee performances, and what other cast changes this might necessitate, had not yet been determined late yesterday, but will be announced shortly by ABT.