By Richard Wike and Bruce Stokes, Special to CNN

Editor’s note: Richard Wike is associate director of the Pew Global Attitudes Project. Bruce Stokes is director of Global Economic Attitudes at the Pew Research Center. The full survey results are available here. The views expressed are their own.

In meeting with Chinese President Hu Jintao two months ago, President Barack Obama said: “Over the last several years…we have been able to really create a new model for practical and constructive and comprehensive relations between our two countries.” By early July, on the campaign trail in Ohio, he was touting his administration’s record for bringing “trade cases against China at a faster pace than the previous administration.” This was underscored by the Obama administration’s September 17 unfair trade case at the World Trade Organization against alleged Chinese subsidies of auto parts exports.

Meanwhile, the president’s Republican challenger, Mitt Romney, has promised that on his first day in office he will issue an executive order branding China a currency manipulator, possibly triggering a trade war. However, in a Wall Street Journal op-ed on February 16, he stated that “a trade war with China is the last thing I want,” and then backed away from the threatened executive order by saying that he would designate Beijing a currency manipulator “unless China changes its ways.”

The casual observer might be excused if he or she concluded that the candidates were presenting a mixed message about the China policy they would pursue if they win in November. This paradox may simply reflect the candidates’ efforts to reconcile the imperatives of campaigning versus the constraints of governing when confronted with sharply contrasting views of China.

On the one hand, the candidates are attempting to woo voters worried about China’s rise. On the other, China experts are advising that whoever is elected president will one day have to deal constructively with Beijing.

Reconciling these often conflicting perspectives may prove one of the toughest foreign policy challenges facing the next U.S. president.

Most Americans describe relations between the U.S. and China as good, but most consider China a competitor rather than an enemy or partner, according to a new survey by the Pew Research Center.

Indeed, when asked which country represents the greatest danger to the U.S., more Americans volunteer China (26 percent) than name any other country, including Iran and North Korea. And about half (52 percent) view China’s emergence as a world power as a major threat to the U.S.

In particular, nearly eight in ten Americans say the large amount of U.S. debt that is held by China is a very serious problem for America; majorities also consider the loss of U.S. jobs to China (71 percent) and the U.S. trade deficit with China (61 percent) to be very serious.

But the public is also worried about China’s impact on the global environment (50 percent), cyber attacks from China (50 percent), China’s growing military power (49 percent) and China’s policies on human rights (48 percent) as major problems.

It is little wonder then that only 26 percent of the public say the U.S. can trust China.

Nevertheless, the public is divided on what to do about China: 28 percent want the next president to build a strong relationship with Beijing, 24 percent want him to be tough with China on economic and trade issues.

Obama and Romney are hearing a slightly different story from the foreign policy community, including government officials, retired military officers, business and trade leaders, scholars and the media, also surveyed by the Pew Research Center.

Like the general public, strong majorities of these experts, more than seven in ten, see China as a competitor rather than an enemy or partner.

Also, like the public, retired military officers are more likely to name China as the country that represents the greatest danger to the U.S. In contrast, Iran is cited more frequently by government officials, business and trade leaders and members of the news media.

But, for the most part, foreign affairs experts are far less concerned than the general public about issues related to China. Less than half of the retired military officers and less than a third of the other experts view China’s emergence as a world power as a major threat to the U.S.Fewer than four in ten say the loss of U.S. jobs to China, the U.S. trade deficit with China, China’s growing military power and China’s policies on human rights are very serious problems for the U.S.

Only cyber attacks from China are considered a very serious problem by at least half of the experts surveyed. Retired military officers are especially concerned.

Still, experts are not that much more trusting of Beijing than is the public. Only about a third or less say the U.S. can trust Beijing. However, they place a much higher priority on building a stronger relationship with China (62 percent versus 28 percent among the public).

The November 6 presidential election will not be determined by the candidates’ views on China. But given the public’s fairly hawkish views on China, both Obama and Romney will not shy away from sounding tough on Beijing. And, after election day, whoever is the next president is likely to hear more cautionary advice from foreign policy experts.