A teenage girl hid in a Dunedin public toilet after she was spooked by a man who made "inappropriate sexual comments" to her, police say.

The 14-year-old schoolgirl was walking in the Octagon when the man allegedly made the comments, Senior Sergeant Phil Hamlin, of Dunedin, said.

The man, in his early 20s, said some "pretty inappropriate stuff" that "alarmed her and offended" her, he said.

The teen went to the Dunedin Public Library and locked herself in a toilet so she did not have to interact with the man again, he said.

Advertisement

While in the toilet, she called a friend, who called police, Mr Hamlin said.

She was not followed to the library, he said.

"She did everything right."

Police spoke to several people in the Octagon at the time, including the man wanted in relation to the incident.

He was spoken to again by police at his home, Mr Hamlin said.

No one was arrested in relation to the incident and the investigation continues.