I did it in this way:
module.exports = {
lifecycles: {
beforeCreate(data) {
if (someCondition(data)) {
// throw error here, it will prevent the entry creation
throw strapi.errors.badRequest('Some message you want to show in the admin UI');
}
},
},
};