Changing an entries data in onBeforeSaveEntry event depending on data set in saved entry
You need to set an array of category IDs to your categories field.

$featuredEntry-&gt;setContentFromPost(array(
    'category' =&gt; array(42)
));


Query for it with an craft.categories criteria model or if you're hardcoding it anyways you could just look it up in the CP:


  example.com/admin/categories/myCategoryGroup/42-myCategoryHandle