The rival candidates for governor of Virginia are engaged in a million-dollar ratings battle, being fought in 30-second intervals on television stations throughout the state, in which their first goal is to persuade voters that there is a clear difference between them on the issues.

Although the election is less than seven weeks away, a recent poll showed nearly one-fourth of the state's voters are undecided about who they will vote for in the gubernatorial race.

Republican Wyatt B. Durrette and Democrat Gerald L. Baliles apparently are far from household names, or faces, to many Virginians. Even Channel 4 mixed up the contenders in a news report about their first televised debate.

The first of Durrette's spots appeared on stations here this week, paid for by a $100,000 donation from the Republican National Committee.

They came nearly a month after Baliles' first commercial was aired.

Even with that boost, Baliles continues to outspend Durrette.

Neither camp is anxious to say how much it will spend by the Nov. 5 election, but Ed Debolt, Durrette's media consultant, said it would be about half of the overall budget, or something over $750,000.

So far, both candidates are taking the high road, suggesting that they are better equipped to bring more jobs, improved roads and better schools to the state, for the most part without personally criticizing the oppositon.

The closest thing to a personal attack is a series of 10-second Baliles' spots titled "Flip Flops." They show a roller coaster whirling upside down, as an announcer ticks off one of a series of topics on which the Democrats contend Durrette has changed his position: death penalty, Equal Rights Amendment, collective bargaining, early release of criminals, a department to protect the environment. "Ever wonder if Wyatt Durrette is just taking us for a ride?" the announcer asks.

In the hardest hitting of the five commercials boosting Durrette, the one-time Fairfax County legislator says: "There are some important differences between my opponent and me. On the issue of jobs, I favor better leadership, he favors bigger government. Education: I want to pay good teachers more, he wants to pay all teachers the same. More of the same is just not good enough. The challenge of leadership is to work with people to find new and better solutions to our problems. That's the kind of leaderhip I want to provide as governor."

David Doak, the political consultant who designed Baliles' ads, said that "in the first round we wanted to introduce Jerry as a person of some quality and accomplishment, give him some added depth."

Don Harrison, Durrette's press secretary, said the goal of the GOP nominee's initial commercials is to "tell people more about Wyatt, what kind of man he is." Harrison said the spots highlight "key issues in a very positive manner, and show Wyatt as issue-oriented, because that's the way he is."

The working titles of the commercials offer a capsule summary of the issues.

Baliles', using the theme "New Ideas for a New Dominion," are titled: Qualifications, Tested Leader, On the Move, Education and Toxic Waste. Durrette's theme is "Leadership for Virginia's Future," and his ads are titled: Vision, Education Involvement, Jobs for Virginians, Better Textbooks and Important Differences.

Baliles makes the most of his connection with Gov. Charles S. Robb, whose popularity in Virginia is even higher than that of President Reagan, according to one poll.

"I've worked with Chuck Robb the last four years and I'm running for governor now because we can't rest on our success," he says in one ad.

In another, he is shown being introduced by Robb at the state Democratic convention as "the next governor of Virginia."

And in still another, the camera pans from the door outside Robb's office to oil portraits of other popular Virginia governors -- Thomas Jefferson, Patrick Henry and Colgate Darden. A voice says: "A great heritage of leadership, governors tested by service, consistent, steady in their beliefs, and not afraid to innovate, because the new ideas they had were anchored in experience, so this year for governor Jerry Baliles."

Because the top Virginia officials elected statewide are Democrats -- Gov. Robb and Lt. Gov. Richard Davis -- Durrette is stuck with trying to suggest he can improve things without making a frontal attack on a popular incumbent.

The GOP nominee is most specific in a commercial calling for "Better Textbooks." Sitting on the edge of a teacher's desk, holding a book, Durrette tells an imaginary group of students: "One of my top priorities will be to make certain that you have better textbooks. The books that you use now are not very challenging because many of the larger states want them that way. I want Virginia to lead the way in setting higher standards so you have better books. Better textbooks, more emphasis on reading and math, better teaching training and merit pay are just some of the things I want to do as governor, to make certain you get the education you need."