The Nevada Gaming Board today approved Frank Sinatra's application to have his once-revoked gaming license restored, after a 5 1/2-hour hearing that at times had the air of a church social and at other times the aura of a Humphrey Bogart movie based on a Damon Runyon story.

The vote came 17 years after Sinatra's gambling activities were ended here because of his alleged ties to the underworld. Sinatra testified for more than two hours, sometimes playing his almost legendary tough-guy role and at other times acting like the chairman of the board -- a nickname he had been given years ago -- totally in control of his corporation, which, judging from his demeanor, seemed to be the state of Nevada.

The action by the three-man board today, if approved by the full Nevada Gaming Commission, would grant Sinatra a six-month license to be an entertainment and public relations consultant to Caesars Palace Hotel in Las Vegas. The full commission will take up the matter Feb. 19 and can accept, reject or alter the board's recommendation.

Sinatra paraded character witnesses ranging from actor Gregory Peck to the sheriff of Los Angeles County. The sheriff, Peter Pitchess, summed up his testimony about Sinatra by saying: "If Mr. Sinatra is a member of the Mafia, then I'm the godfather."

Most of the hearing followed that pattern. No one testified against Sinatra. And while the testimony was filled with questions about a Who's Who list of mob figures, it also was heavy with references to the singer's "close friendship with the highest authority in the land" -- meaning President Reagan, whose White House birthday party the controversial entertainer attended just last week.

The hearing was staged against a highly emotional Las Vegas backdrop, only a dozen hours after the second major high-rise resort hotel fire in just three months in this tourist-dependent, neon-garnished desert town.

The fires, plus economic conditions, including head-on legalized gambling competition from the state of New Jersey and the high price of fuel, which has cut down on weekend gamblers from California, threaten to send Nevada's economy reeling. Most public officials here, as well as casino owners and the state's major newspapers, endorsed Sinatra's proposed reentry into Nevada gambling as a shot in the arm for the state's economy.

In the hearing room, the official seal of the city of Las Vegas loomed almost grotesquely behind the commissioners. The major feature in the seal is a cluster of modernistic skyscraper hotels of the type in which almost 100 persons have died here in the last three months. It was clear, although unstated, that the economic situation here was paramount in the hearing. It was equally clear that the result of the hearing was a foregone conclusion.

Just before the board voted, chairman Richard Bunker looked out over an audience of reporters and television crews from around the world and said: "I get sick and tired of hearing that everything that happens in this state happens because it's wired beforehand."

Bunker and others charge that Sinatra's life has been plagued by unproven "gossip and innuendo" in the press. "I am not suggesting he is a saint," Bunker said, "but we are not going to have a group of choir boys [running the gambling industry in Nevada]."

Whether the decision was "wired" or not, Sinatra, the one-time bobby-soxers' idol whose hair now has gone steel gray and whose face has toughened into an unchanging mask, walked into the hearing as if he were in total control.

At times he testified that he simply didn't remember anything about major incidents in his life. At other times he shot off some of his now-famous Rat Pack one-liners. And at other times has attitude edged from cockiness to a sort of condescending hostility.

Sinatra had owned interests in two Nevada casinos in 1963, when his license was revoked after a profane telephoned shouting match with the then-chairman of the gambling commission and charges that Sinatra associated with Sam Giancana, an organized crime figure who later was killed in a gangland slaying.

In 1963 Giancana visited one of Sinatra's casinos, the Cal-Neva, in Stateline, Nev., an incident that led to the license revocation.

Today Sinatra's memory was fuzzy about whether he was at the casino at the time of Giancana's visit, but he denied ever having any business associations with the mob boss. One by one, Sinatra also denied business ties with a string of organized crime figures to whom he has been linked in news stories and in investigations of organized crime.

As the commissioners rattled through the long list of names, Sinatra sometimes wrote off the connections with answers that could have come out of some of his long repertoire of B-movie scripts.

"Mr. Sinatra, were you ever acquainted with a man named Matthew Ianella?" he was asked.

"I don't think so. What's his alias?"

"His alias is Mattie the Horse."

"Oh, yeah."

At other times he dismissed his meetings with crime figures such as Lucky Luciano, whom he met in Havana in the 1940s, with a combination of terse answers and biting humor. Asked why he went to Havana, he answered abruptly: "Find sunshine."

Asked if it was true that he carried $2 million in cash to Luciano in an attache case, Sinatra replied: "If you can find me an attache case that could hold $2 million, I'll give you the $2 million."

Chairman Bunker smiled and acknowledged that one had his investigators a bit stumped, too.

Sinatra has been photographed with mob leaders ranging form Luciano to Carlo Gambino. Sinatra wrote that off as typical of showbiz and brought out an album of 1,000 backstage pictures in which he posed with people ranging from the 1975 muscular dystrophy poster child to Egyptian President Anwar Sadat.

"When I entertain down the street at Caesar's Palace I'm often asked to pose with people. If I'm asked to pose with three Chinamen from Hong Kong, I don't give 'em a spittum test," Sinatra said. He also pulled out a backstage photo in which he posed with what he called "unsavory-looking characters" who happened to be San Francisco police inspectors.

"If you looked at this picture, without me telling you who they were, it would frighten you," Sinatra said.

At the end of it all the three commissioners, one after the other, said that Sinatra had answered all their questions to their satisfaction and that their investigation had proved none of the allegations against the singer.

But Bunker, somewhat defensively peering out at the crowd of reporters who had covered Las Vegas' big fire last night and now its big hearing today, added his opinion: "I have come to the point where I really don't care what people outside of Nevada think of us, whether it's the national media or the public."

Perhaps one of the Sinatra witnesses, a small casino owner named Claudine Williams, summed up the feeling here best. She said that she has not had the "privilege" of becoming a friend of Sinatra, but she wanted him back in Nevada as a fellow entrepreneur in the gambling industry.

Williams said she wanted Sinatra here "for a selfish reason.Because when Mr. Sinatra plays on the Strip my [cash] boxes are full."