How to validate recaptcha on comments form?

There’s a preprocess_comment filter that is run before the comment is inserted in the database.

You will have access to the comment’s data:

add_filter( 'preprocess_comment' , 'wpse321083_process_recaptcha' );
function wpse321083_process_recaptcha( $commentdata ) {
    // Process recaptcha here
    return $commentdata;
}

Here’s also a good article on SitePoint.com explaining how to implement this feature in your website.

tech