Emergency services were called to a funfair near Ayr Racecourse at about 21.30 on Saturday.
Two boys, aged 16 and 17, and three girls, aged 14, 15 and 16 were reportedly thrown from a ride. One of the boys suffered broken ribs.
Police Scotland described the incident as a "frightening experience" for those involved.
A joint investigation between Police Scotland and the Health & Safety Executive is under way to establish what happened and officers remained at the scene with the ride cordoned off.
Reports on social media spoke of a section of the ride breaking and coming loose while people were on it.
The teenagers were taken to Ayr and Crosshouse hospitals and have all since been released.
Police Scotland said a 16-year-old boy was treated for several broken ribs while the 16-year old girl was treated for a facial injury and fractured wrist.
The 17-year-old boy suffered a minor head injury and the other two girls were both treated for minor injuries
Ch Insp Brian Shaw said: "This was a frightening experience for those involved and those who witnessed last night's incident at the fairground.
"Thankfully nobody was seriously injured and inquiries are under way to establish what exactly has happened here.
"The ride affected remains closed and cordoned off whilst the joint investigation is underway. Other unaffected rides re-open later this morning following a safety inspection.
He added: "I would appeal to anyone who witnessed last night's incident and is yet to speak to police to get in touch as any information about what happened could assist with our investigation."
A spokeswoman for South Ayrshire Council confirmed the fairground site had been issued with a public entertainment licence and said the matter now rests with the Health and Safety executive and Police Scotland.
She said the council would work with them as required.
Five teenagers have been treated in hospital after being involved in an incident on a fairground ride in Ayr.