You just need this in stb_image.c
:
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
Then in your build.zig
you can add this file to the executable like this:
exe.addCSourceFiles(.{.files = &[_][]const u8{"path/to/stb_image.c"}, .flags = .{"-g"}}); // -g adds debug info, makes it easier to debug