How to add a custom row class or ID to type table render elements
Can you try code the below.

$row = array('data' =&gt; 'some data');
$rows[] = array('data' =&gt; $row, 'class' =&gt; 'some class');
);


Or maybe

$row = array('data' =&gt; 'some data');
$rows[] = array('data' =&gt; $row, 'class' =&gt; array('some class'));


Reference answer https://www.drupal.org/forum/support/post-installation/2016-04-21/add-class-in-row-with-theme-table