One of the FBI’s Ten Most Wanted fugitives was shot dead in a hotel room by the FBI on Wednesday, officials said.

Agents tracked Greg Alyn Carlson — who was accused of multiple violent sex crimes in Los Angeles — to a hotel in Apex, North Carolina.

When officials entered his room at the Woodspring Suites, a struggle over a gun broke out and Carlson was shot and killed.

The fugitive’s car had been spotted Tuesday night by an Apex police officer, leading to Wednesday’s raid.

Carlson, 47, had been in the wind since September 2017, when he was released on bond on charges of assault with intent to commit rape, assault with a deadly weapon and burglary.

The FBI said its linked Carlson to sexual assaults dating back to 2003 using DNA.

After his release, Carlson fled for Mount Pleasant, South Carolina, and then left the state with a stolen gun and a wad of cash, officials said.

He was spotted in Hoover, Alabama, on Nov. 22 and led police on a high-speed chase. Carlson was seen later in November in Florida.

With Post wires