You can use
$field = trim($_POST['field']);
$_POST['field'] = str_replace(' ', '', $_POST['field']);
and check it as alpha in the rule, then you can use $field after successful validation.
$this->form_validation->set_rules('field', 'FIELD', 'alpha');