Activate small php condition at footer over page template

This would be a viable way to do it from a plugin, however it seems like it would make more sense in a template file.

If it’s a universal option, you would create an option either through a custom settings page or just by initializing on plugin activation in the activation hook (if its a static value):

function wpse_photoswipe_activate_plugin() {
    $page_id = 123; // This could be an ID, or if you wanted, a template name
    add_option( 'wpse_activate_photoswipe', $page_id );
}
register_activation_hook( __FILE__, 'wpse_photoswipe_activate_plugin' );

function wpse_photoswipe_deactivate_plugin() {
    delete_option( 'wpse_activate_photoswipe' );
}
register_deactivation_hook( __FILE__, 'wpse_photoswipe_deactivate_plugin' );

Then in your footer template, you could use something like:

global $post;
if ( get_option( 'wpse_activate_photoswipe' ) === $post->ID ) {
    get_template_part( _ps );
}

However, if you want my opinion on the easiest way to do this, since it sounds like you’re already editing template files, is to just update your existing code to:

if ( is_page( $page_id ) ) {
    get_template_part( _ps );
}

There are even more ways to do what you’re suggesting but given the information you provided (existing theme hooks or wp_footer, for example), this should steer you in the right direction.