A couple of cops from the most talked-about show on television stormed the White House last night, nearly upstaging a president and a prime minister.

Before they called it a night, one costar of "Miami Vice," Philip Michael Thomas, had all but signed up President Reagan and his wife, Nancy, and Danish Prime Minister Poul Schlueter and his wife, Lisbeth, for guest appearances.

"Would you guys like to be on the show?" Thomas asked the foursome in the Blue Room following the dinner the Reagans gave for the Danish leader and his wife.

"What can you offer? What can you offer?" Schlueter asked.

"This is the world, this is the world in our hands," said Thomas, the tiny diamond earring in his left lobe glittering under the chandeliers.

"Send us a script," said Nancy Reagan, laughing.

"You have to tie it into drugs," President Reagan told Thomas, who readily agreed.

"You mean antidrugs," said Thomas.

"We'll costar," Lisbeth Schlueter told the president.

"I can't do it," Reagan said, "I've got a run of the play contract."

But Thomas wasn't the only one negotiating. During dinner, Mrs. Reagan enlisted the help of his costar, Don Johnson, to work on her antidrug abuse crusade.

"Naturally, I offered my services," said Johnson.

The costars of "Miami Vice," the sizzling NBC-TV series that has been keeping America home on Friday nights, created a sizable stir when they arrived at the White House. Thomas was resplendent in a bishop's-purple shirt with a formal-style tuxedo that appeared to be laced with glittery threads. Johnson wore a more traditional tux. There wasn't a pastel tone in either outfit.

Johnson, who arrived with his girlfriend Patti D'Arbanville, made no pretense at modesty. His popularity, he guessed, was what had brought him to the White House. "They like me," he said, smiling. "Do the Reagans watch the show?" he was asked. "Oh, yes, it's very big here in the White House. I also understand it's big at the Kremlin." D'Arbanville winced.

Thomas, on the other hand, showed a little more restraint when asked about his new celebrity. "Everything is moving straight up," said Thomas, who was accompanied by his brother George. Referring to the invitation to the White House, Thomas said, "It's a continuum, another brick on top of the building."

And then he paused, frozen in his sultry "Vice" slouch, and offered, "That is what I asked today: Where do I go after this? I don't know."

For the moment, anyway, Thomas and Johnson joined the 114 other guests.

Not everything was "Vice" or politics last night. Reagan made a point of telling everybody after his toast: "Pete Rose has been to bat twice, and he hasn't hit yet." His audience erupted with laughter.

Later, when asked how he knew that, Reagan said he was supposed to call Rose if he got a hit, making him baseball's all-time hitter. "The game's over and he didn't get a hit," said Reagan, "so we'll wait for tomorrow night."

Besides baseball, Reagan used the occasion to plug tax reform. In congratulating Schlueter on his "far-reaching" tax reform, he said he could well imagine how difficult it was.

"Our efforts at tax reform remind me of one of Denmark's better known fairy tales," Reagan said. "When I talk about reforming the tax shelter, or systemize, let's say, I visualize a beautiful swan. All special interests see is an ugly duckling."

The other media stars at the dinner, decidedly more reticent than Johnson and Thomas, were Dan Rather, the CBS anchor, who stopped for pictures, but not for words; Glenn Brenner, the excitable sportscaster on WDVM, who walked through waving his hands and saying, "No comment," and Danny Kaye, who took one look at the cameras and said, "This is running the gauntlet." Kaye, who seemed to relish the attention, raised his finger when a photographer asked him for one more picture. Admonished Kaye, "That's a cry of an insecure photographer." Anthony Thomopoulos, an executive at ABC, was accompanied by his wife, Cristina Ferrare. They ignored reporters' invitations to stop and chat.

Some other arriving guests talked about today's expected vote in the Senate on whether to go ahead with sanctions against South Africa. Both Sen. James Abdnor (R-S.D.) and Sen. Don Nickles (R-Okla.) said they were satisfied with the president's executive order, issued Monday, that enacted limited sanctions against South Africa. "The sanctions have been passed. The president has enacted what the bill wanted," said Nickles. Abdnor added, "I am supporting the president. The bill is not an issue in South Dakota."

"I was asked to do ballads and love songs," said Vic Damone, last night's entertainer, who has known Nancy Reagan since she was under contract at Metro-Goldwyn-Mayer. "I think she's a romanticist. So I've included 'So Easy to Love' and 'When I Dream.' "

Nancy Reagan was wearing a creamy white gown by Oscar de la Renta, which had a silver pattern woven through the bodice and a pleated skirt. Lisbeth Schlueter wore an ivory lace dress.

The dinner had originally been planned for the Rose Garden. But at noon yesterday the first lady's staff decided that the predictions of high heat and humidity and the threat of thunderstorms might ruin the garden party. By 5 p.m., just as the staff was putting the crown of lilies on trees of white daisy mums and white geraniums in the hallway inside, the rains started.

The hastily arranged State Dining Room resembled an intimate field of flowers, with votive lights scattered through the arrangements of white lilies, white roses and white orchids. The menu included vegetable mousse with seafood, chicken galantine with tarragon sauce and honey liqueur mousseline to be served on the ruby-edged Reagan china.

Even though romance may have been a theme for the evening, Damone was without his own love. Diahann Carroll, actress and singer, had to cancel at the last minute so she could make a 10 a.m. call on the set of "Dynasty" today.

The guest list for last night's White House dinner for Denmark's prime minister:

Prime Minister Poul Schlueter and Lisbeth Schlueter

Danish Ambassador Eigil Jorgensen and Alice Jorgensen

Peter Wiese, permanent undersecretary, prime minister's office, and Mrs. Wiese

Otto E. Moller, ambassador, permanent undersecretary of state, Ministry of Foreign Affairs

Henning Gottlieb, foreign affairs adviser, prime minister's office

Ulrik Federspiel, minister, Danish Embassy, and Mrs. Federspiel

Hans Michael Kofoed-Hansen, private secretary to the prime minister

Carsten Sondergaard, first secretary, Danish Embassy, and Mrs. Sondergaard

Dorte Christiansen, secretary to the prime minister

Sen. James Abdnor (R-S.D.) and niece Lee Abdnor

Harold W. Andersen, president, Omaha World-Herald, and Marian Andersen

Randolph Antonsen, Spartanburg, S.C., and Constance Armitage

Hans C. Basse, president, Danish-American Society, and Annemette Basse

Geoffrey Beene, designer

Benjamin L. Berry IV, Narberth, Pa., and Alexandra Berry

Kenneth Lee Blaylock, president, White House Photographers Association, and Deanne Blaylock

Sen. David L. Boren (D-Okla.) and Molly Boren

Glenn Brenner, sportscaster, and Linda Suzanne Brenner

Robert Brown, chairman, B&C Associates Inc., and Sallie Brown

William N. Cafritz, Bethesda, and Buffy Cafritz

Angel T. Cordero Jr., jockey, and Marjorie Clayton

Earle M. Craig Jr., Midland, Tex., and Dorothy Craig

Bruce Crawford, general manager, Metropolitan Opera Association, and Christine Crawford

Vic Damone, singer (performing)

Stephen I. Danzansky, Washington, D.C., and Joan Danzansky

Fernando C. De Baca, president Del Bac Industries, and daughter Carol Ann De Baca

Kathleen Drake, Philadelphia

Rowland Evans Jr., columnist, and Katherine Evans

Richard M. Furlaud, chairman, Squibb Corp., and Isabel Furlaud

Ted Graber, interior designer

Rep. Elwood H. Hillis (R-Ind.) and Carol Hillis

Rep. Steny Hoyer (D-Md.) and Judith Hoyer

Don Johnson, actor, and Patti D'Arbanville

Danny Kaye, entertainer, and Sylvia Kaye

Joseph Krentzel, chairman, Danish American Coordinating Council

Robert W. Lear, professor, Columbia University School of Business, and Dorothy Lear

Rep. Robert Livingston Jr. (R-La.) and Bonnie Livingston

Charles T. Mayer, chairman, Transat Energy Inc., and Franziska, Countess Starhemberg

Robert C. McFarlane, assistant to the president for national security affairs, and Jonda McFarlane

Carl E. Meyer Jr., chief executive officer, TWA, and Ruth Meyer

James C. Miller III, director-designate, Office of Management and Budget, and Demaris Miller

James Nicholas, Scarsdale, N.Y., and Kiki Nicholas

Sen. Don Nickles (R-Okla.) and Linda Nickles

Dorothy Parish, interior designer

Dr. Luis Queral, Owings, Md., and Dr. Eva Ramos Queral

Dan Rather, CBS news anchor, and Jean Rather

Maureen Reagan

Donald T. Regan, White House chief of staff, and Ann Regan

Rozanne L. Ridgway, assistant secretary of state, and Capt. Theodore Deming, U.S. Coast Guard

Selwa Roosevelt, chief of protocol, and Archibald B. Roosevelt Jr.

Pete Rozelle, commissioner of the National Football League, and Carrie Rozelle

Telly Savalas, actor, and Katherine Nicolaides Savalas

Rabbi Arthur Schnier, New York

Carol Schwartz, D.C. City Council member, and David Schwartz

George P. Shultz, secretary of state, and Helena Shultz

Jackson T. Stephens, Little Rock, Ark., and Mary Anne Stephens

Robert Stigwood, movie producer, and Sandra Powers

Philip Michael Thomas, actor, and brother George Thomas

Anthony D. Thomopoulos, ABC, and Cristina Ferrare

Ambassador Terence A. Todman, U.S. ambassador to Denmark, and Doris Todman

Heidi Toffler, New York

Robert Tookey, La Canada, Calif., and Marcia Tookey

Jean Vanderbilt, New York

Mario Vargas Llosa, author

George Watson, ABC News vice president, and Ellen Watson

Robert Woll, Willow Grove, Pa., and Doris Woll