The fire broke out around 2 a.m. on the 24th floor of a 41-story building on 515 East 72nd Street on the Upper East Side.
The FDNY says firefighters got the flames under control in about an hour.
Eighteen people were taken to the hospital for treatment.
Two are in critical condition.
Four people refused medical attention.