It is, in most cases, a logical thing to show the homepage even when there are querystrings available. Never the less, I’m assuming you have a reason for this. You could try code below to redirect your visitors to your 404 page:
if ( isset($_GET) ) {
global $wp_query;
$wp_query->set_404();
status_header( 404 );
get_template_part( 404 );
exit();
}
Keep in mind that some other functionality might break because of this. You may want to add some additional conditionals.