Representative Ron DeSantis, the Republican nominee for governor in Florida, drew accusations of using a racist dog whistle on Wednesday after saying in a television interview that voters should not “monkey this up” by electing his opponent, Andrew Gillum, who would be the state’s first black governor.

Mr. Gillum, the mayor of Tallahassee, won the primary election in an upset on Tuesday night, handing a major victory to the liberal wing of the Democratic Party.

In the interview with Fox News on the first day of the general election campaign, Mr. DeSantis, 39, who has President Trump’s support, attacked Mr. Gillum’s candidacy by painting him as a far-left socialist.

[Read more about some things to know about Mr. DeSantis]

“The last thing we need to do is to monkey this up by trying to embrace a socialist agenda with huge tax increases and bankrupting the state,” he said. “That is not going to work. That’s not going to be good for Florida.”