Prevent Plugin from loading on ‘wp-admin / wp-login’

You can try with the following example to stop the code running on admin side or on wp-login.php page.

if ( ! is_admin() || 'wp-login.php' != $GLOBALS['pagenow'] ) {
    // Do stuff here. code inside this statement will 
    // not run on wp-admin & login page.
}