twig attribute class
Put the classes in an array:

{%
  set itemclasses = [
    'project-label',
    'project-term' ~ loop.index,
  ]
%}


And add the array to attributes:

{% set item = item|merge({'#attributes': { 'class': itemclasses } }) %}