Scholz made the comments in response to a question from a student at Tongji University, who asked whether he would have to smoke cannabis if he studied in Germany, as the drug was not legal in China.
Germany passed legislation to legalise cannabis in February, allowing individuals and associations to grow and possess limited quantities of cannabis.
"We don't want more people to consume cannabis, we want fewer people to consume cannabis, we want there to be more public education about it," Scholz said.
"The answer is very simple: don't smoke. I'll be 66 this year and I've never smoked cannabis."
The chancellor, who is on a visit to China and will meet leaders in Beijing on Tuesday, said Germany wanted to bring cannabis "out of the grey area".
Some 4 million people consumed cannabis in Germany in 2022, according to health ministry data.