How to 301 redirect to subdirectory but keep access to wp-admin of main domain

I’m assuming that you are willing to do this for maintenance mode, 301 is for permanent redirect.
You can add this snippet in functions.php to enable redirection of the entire wordpress site to another site.

add_action( 'template_redirect', 'wp_maintance_mode' );

function wp_maintance_mode() {
        wp_redirect( "http://new_url" ); 

// or if the folder is outside wordpress and lies under same url
wp_redirect( home_url('/folder_name')  );
        exit;
}