Add classes to form select option item
Unfortunately this isn't very easy using the Form API currently.

There's an issue open to add this functionality (it goes all the way back to 2008) that would theoretically allow you to do something like this:

$form['optiontest'] = array(
  '#type' =&gt; 'select',
  '#title' =&gt; t('Option test'),
  '#options' =&gt; array(
    array(
      '#return_value' =&gt; 0,
      '#value' =&gt; t('First option'),
      '#attributes' =&gt; array('class' =&gt; 'first', 'title' =&gt; t('First option')),
    ),
    array(
      '#value' =&gt; t('Option group'),
      '#attributes' =&gt; array('class' =&gt; 'group', 'title' =&gt; t('This is an optgroup')),
      '#options' =&gt; array(
        array('#return_value' =&gt; 2, '#value' =&gt; t('1st sub-option')),
        array('#return_value' =&gt; 4, '#value' =&gt; t('2nd sub-option')),
      ),
    ),
  ),
);


But unfortunately there are nothing but failed patches attached to the issue at the moment.

The only way I can think of to do it at the moment would be to add a #process function to the select element, and add the class(es) to each option when they're broken down individually.