It might have been a scene from "The Last Hurrah." At the podium was the square-jawed elder statesman, being honored by his party, while sitting nearby was the young heir-apparent, biting his fist and anxiously awaiting the nod that would pass the torch to the next generation.

But the scene here Monday night wasn't a fictionalized political plot set in Massachusetts. It was real life Virginia, and it produced the most painfully public spectacle yet for J. Marshall Coleman, the ambitious state attorney general, who once again was denied an endorsement from two-time governor Mills E. Godwin.

Though Coleman is unopposed for the Republican nomination for governor, the best he could get from Godwin was recognition of "our distinguished attorney general" during a speech that one observer said was "either a veiled threat or a veiled endorsement."

"If we have candidates with whom we feel compatible," Godwin told a sell-out crowd of 400 at the Sheraton Fredericksburg, "we can move on to victory after victory." But only "those who come close to the kind of conservative thinking the majority adhere to" will be elected in November, he warned.

While Godwin extolled the virtues of the GOP, he reminded the audience that "I'm a Byrd man," who was elected governor as a Democrat in 1966 and as a Republican in 1974. Four years ago, he supported his old friend, Democrat Ed Lane, when Coleman ran as a liberal Republican against the former segregationist.

Godwin's blessing would be of no small significance for Coleman. A nod from the former governor, whose switch of allegiance in 1973 helped fuel an explosion of GOP growth in Virginia, would amount to a signal to thousands of likeminded Byrd Democrats whose support could be crucial to Coleman's election hopes.

But Godwin remained aloof. He is said to bear lingering resentment at Coleman's ability to outmaneuver Lane in 1977 by shifting to the left, and has acknowledged he knew of secret but unsuccessful efforts last fall by wealthy Virginia conservatives to derail Coleman's drive for the governorship.

At the end of the speech, Coleman passed behind Godwin on the platform without speaking to him, as reporters besieged Godwin with questions about how his remarks should be interpreted.

"It wasn't the right time," Godwin said. "I will discuss it [his endorsement] at another time. This was a program designed for another purpose" (to honor Godwin).

Coleman called it "a great speech," which he said he "took at face value . . . as a call to arms." He later returned to the podium and congratulated Godwin, which Godwin perfunctorily acknowledged.

Coleman's likely opponent, Lt. Gov. Charles S. Robb, isn't faring much better in the Democratic Party, where 1977 gubernatorial nominee Henry Howell has withheld his support for the opposite reason, believing that Robb is too conservative.

Republicans in Virginia apparently are accustomed to such a performance from Godwin. June Funkhouser, state committee member and Orange County GOP chairman, said Godwin was "rather strong about the party," and shrugged off the lack of an endorsement.

One Coleman booster took solace from the partisan nature of Godwin's speech. "At least that ought to mean he's not going to support Robb," he said.

State Republican Chairman Alfred Cramer of Culpeper also was optimistic. Crane said that Godwin was urging support of Republicans, and "that means all our candidates."

Until Godwin decides the time is right, which could be after Labor Day, if at all, Coleman apparently will have to be satisfied with ringing endorsements from incumbent Gov. John N. Dalton and a string of Reagan administration officials, including Vice President Bush, who vigorously endorsed him at a rally at Tysons Corner last week, and Treasury Secretary Donald T. Regan, who is scheduled to join Coleman at a rally in Roanoke Wednesday night.