Actually I found partial solution on one of the links on the forum.
This is what I need to do:
$config->set('HTML.Nofollow', true);
$config->set('HTML.TargetBlank', true);
So the full thing looks like this:
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Nofollow', true);
$config->set('HTML.TargetBlank', true);
$config->set('HTML.Allowed', 'a,b,strong,i,em,u');
$purifier = new HTMLPurifier($config);