A female Australian employee of a Carnival Cruise ship has been allegedly raped by a co-worker while on board.

The rape is alleged to have taken place on the Carnival Liberty, which is docked in San Juan, Puerto Rico, in the Caribbean.

Puerto Rican authorities had detained the man accused of raping the woman, 9 news reported.

An Australian woman working on board the Carnival Liberty was reportedly raped in one of the cabins of the cruise ship while berthed in San Juan (stock photo)

However, the unidentified man had not yet been charged. It was reported the rape took place in one of the ship's cabins.

Police in Puerto Rico had earlier mistakenly identified the woman as a tourist on board the cruise ship.

Jennifer De La Cruz, a spokeswoman for Carnival, confirmed the cruise ship employee is Australian.

The man accused of raping the Australian woman has been detained by Puerto Rican authorities but has not been charged (stock photo)

Earlier in the week-long Caribbean cruise, one of the engines caught fire while the boat was berthed in St. Thomas in the US Virgin Islands, US News reported.

The ship was evacuated and there were no injuries.

Sprinkler systems on board the ship put the fire out, and passengers were allowed back on the ship later in the day.

It was reported there were 3,346 guests and a crew of 1,150 on board the Carnival Liberty.