A suicide bomber detonated an explosives-laden truck used for carrying water at a police school in central Zliten, a coastal city about 170 kilometres east of the capital Tripoli, a local security source told AFP.
A witness in Zliten told AFP some 300 men, mainly coast guards, were inside the training compound at the time of the blast.
Health ministry spokesman Ammar Mohammed Ammar said 50 to 55 people had been killed and at least 100 wounded and that victims were being treated in several hospitals. Urgent calls were issued for blood donations.
A spokesman for the Zliten hospital, Moamer Kadi, told AFP it had received at least 40 bodies and was treating 70 wounded.
"We don't have a clear idea of the total toll, other victims were taken to hospitals in Misrata and Tripoli," he said.
The hospital in Misrata, about 55 kilometres east of Zliten, said it had received at least four bodies and was treating some 50 wounded.
"I condemn in the strongest terms today's deadly suicide attack in Zliten, call on all Libyans to urgently unite in fight against terrorism," he wrote on Twitter.
Libya has been beset by chaos since the 2011 overthrow of longtime dictator Muammar Gaddafi and IS has been gaining influence.
The country has had rival administrations since August 2014, when an Islamist-backed militia alliance overran Tripoli, forcing the government to take refuge in the east.
The United Nations is pressing the rival sides to accept a power-sharing deal.
In a statement after today's attack, EU foreign policy chief Federica Mogherini urged Libyans to back the agreement.
"Once again the Libyans are mourning victims of an attack," she said. "The people of Libya deserve peace and security and... They have a great opportunity to set aside their divisions and work together, united, against the terrorist threat facing their country.
