How to register and set http/2 server prefetch for a specific asset?

Support for resource hints in WordPress is done through rel attribute of <link> elements whithin the HTML docuemnt, not with HTTP/2 server push (which uses Link headers in the HTTP response). You can use wp_resource_hints filter to add the URLs you need the prefetch like this:

add_filter( 'wp_resource_hints', 'cyb_resource_hints', 10, 2 );
function cyb_resource_hints( $urls, $relation_type ) {

  if( 'prefetch' == $relation_type ) {

    $urls[] = 'https://exmaple.com/assets/script.js';

  }

  return $urls;

}

If you prefer to use HTTP/2 server push, you can set the Link header with PHP, .htaccess on Apache, etc.

For example, with PHP:

header("Link: </css/styles.css>; rel=preload; as=style");

And you can integrate it with WordPress at multiple levels, usually template_redirect action, for example:

add_action( 'template_redirect', 'cyb_push_styles' );
funciton cyb_push_styles() {

    header("Link: </css/styles.css>; rel=preload; as=style");  

}