A five-year-old girl has been raped by a man after she accidentally walked into the wrong public toilets in central NSW.

The girl and her mother were at a park on Woodward Road, Orange, when the girl accidentally went into the male public toilet block on Friday.

When the girl's mother went to get her, the five-year-old told her a man had sexually assaulted her, police say.

Police were called and searched for a 37-year-old man without success until he was found in Moad Street in Orange about 4pm on Saturday.

He was charged with having sex with a child under 10 and was refused bail to face Orange Bail Court on Sunday.