Despite strong protests over the Shah of Iran's state visit this week, Dizzy Gillespie and Sarah Vaughan said yesterday they never hesitated to accept Jimmy Carter's invitation to entertain at the White House.

The two jazz greats, during a rehearsal in the East Room for last night's state dinner, indicated that neither has strong political views.

"I'm apolitical," Gillespie, who is 70, told reporters as he sat on the bandstand smoking a cigar. "I'm bahai so we don't participate in politics."

Vaughan, one of the leading jazz vocalists for the past 30 years, said she isn't "into politics very much - we have discussions at home, we really do, but otherwise I don't get involved."

As they rehearsed, demonstrators across the street in lafayette Square pro- and anti-shah slogans. Vaughan and Gillespie, along with Wills Conover, narrator of last night's program, and members of the band had to take a circuitious route from the Hay Adams Hotel, where they were staying, to get into the Executive Mansion.

"We were well-protected by someone from the White House or we wouldn't even be here now," Vaughan said of the escort provided the troupe.

The program, according to Conover, was intended to present jazz "as America's classical music, which it is regarded as in all other countries of the world except the United States."

Neither Gillespie nor Vaughan had ever performed at the White House before although Gillespie said he had been there about five times as a guest, once during the Nixon years when the late Duke Ellington was honored.

Gillespie also said, somewhat hesitantly, that while he had never before entertained for the shah, he had seen him.

"Nah, I'm not going to tell you where," he laughed, but apparently thinking better of it, went on to describe the shah "in front of the Playboy Club in London with about 10 bodyguards."

An admitted fan of President Carter, Gillespie nevertheless said "My greatest thrill was addressing a joint session of the South Carolina legislature."

"If you make it big, you expect to make it to the White House," said Gillespie. "But if you grew up in South Carolina, a racist society, then (being honored) is something."

Gillespie told of his appearance before the South Carolina legislature a year ago when he gave a speech and played his trumpet, that now familiar 45-degree instrument.

The 30-minute program, compiled of Conover "in the middl eof the night for the last seven nights," spans a musical evolution in a kind of documentary form with a short anthology of Gillespie and Vaughan classics.

Earl "Fatha" Hines, who was among the 140 guests invited to last night's black-tie dinner, provided an early start for both artists. In his narrative, Conover said "that edition (Vaughan, Gillespie and Charlie Parker) of the Hines orchestra was never recorded."

The entertainers' style contrasted consideraly with that offered the shah and his empress the last time they came to town. Then, Ann-Margaret brought her Las Vegas revue to the Gerald Ford White House. And in some respects, the guests that night looked as if they would have been more at home in Las Vegas. There were Bob Hope, Pearl Bailey, Douglas Fairbanks Jr., and Fred Astaire. And Andy Warhol.

Of that group, only Warhol was invited back last night.

Like the Fords did in 1975, the Carters singled out top U.S. businessmen for their dinner tables, which were centered by museum-quality mineral specimens borrowed from the Smithsonian Institution.

Gillespie had a pocketful of what he called "jive" cigars which he insisted were not Cuban although he recently performed in Havana and brought back five boxes.

"The government let me but they have been gone," Gillespie said.

he said he was "very excited, nervous" and that he would "rather perform than anything else," even than eating dinner with the President.

Vaughan said she met Rosalynn Carter briefly in the afternoon.

"She said she was glad to meet me and wished me well. I said I'm more thrilled than she is, Betcha."