I am not sure if WordPress has a function for this but it can be done by creating a simple one yourself.
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
// Is AJAX request
return true;
}