How to dynamically get the figure number as a string?

figure does not have a counter member, but counter can access the current figure counter through counter(figure). Since this is also context-aware function, you need to add context somewhere fitting.

#figure(
  context {
    let fname = "plot_" + str(counter(figure.where(kind: image)).display("1")) + ".png"
    image(fname, width: 100%)
  },
  caption: [_Boxplot showing the difference in alpha diversity between responders and non-responders. All treatment timepoints are cumulated._],
)

Also noticed, if you want all captions to have a specific style, you can add a #show figure.caption: ... rule à la How to make captions italic?

Edit: changed counter(figure) to counter(figure.where(kind: image)) to be more specific