How to know if jQuery UI is being included
There's no built in way but as drupal_add_library() uses Drupal's static pattern you can find out by doing this:

function ui_is_included() {
  // Get the list of libraries included in this page load
  $libs = drupal_static('drupal_add_library');

  // The system library will pretty much always exist as it includes jQuery,
  // but it's just good sense to check just in case.
  if (isset($libs['system'])) {
    // If the system library array includes UI then make sure it's enbabled
    return isset($libs['system']['ui']) &amp;&amp; $libs['system']['ui'] === TRUE;
  }

  // UI is not loaded if we've got to this point
  return FALSE;
}


You can even compress that down a bit:

function ui_is_included() {
  $libs = drupal_static('drupal_add_library');
  return isset($libs['system']['ui']) &amp;&amp; $libs['system']['ui'];
}


I'd advise calling this function as late on in the page build process as possible, to ensure that all modules have had a chance to request that UI is added. hook_preprocess_html() in your theme's template.php file might be a good place to put it.