How do a I add an attribute to element (when using block theme)?

It’s possible to use the language_attributes filter as before since the template canvas in FSE contains:

<html <?php language_attributes(); ?>>

Add this code to the appropriate place in your theme or plugin:

<?php
add_filter( 'language_attributes', function($lang_attributes) {
    return "$lang_attributes foo=\"bar\"";
});