How to get my dirt to not turn into a grass block?

If you space all of the blocks out with one block between them, it would still look good and the grass would not spread as long as there isn’t grass on the blocks below and to the side of the block. Otherwise, you could change up the order of the blocks - though I’m sure this might ruin the display. I’m not great with technical stuff, but you could try lowering the random tick speed to 0... this might last a while. Hope this helps! Edit: you would have to use barrier blocks in between the blocks to run on them with gaps in between. This would mean you couldn’t display barrier blocks, but because they’re invisible it wouldn’t add all that much.