How to allow only two (or more) users access to a plugin

You can create a new user role or set user access level, if you wanted for large group of user.

If not you just go with the normal way of adding the menu. But in printing the admin page just make sure that current user is what you are expecting to see the page.

EG:

    add_menu_page( $page_title, $menu_title,
                   $capability, $menu_slug, 'sample_function', $icon_url, $position );

    function sample_funtion(){
     $allowed_user_list = array(2,18);
     $current_user_ID = get_current_user_id();
    if(in_array($current_user_ID,$allowed_user_list)){
    //now print everything you want. Only allowed user will see it

    }

}

error code: 523