My almost 3 year old is similar.
About a year ago, he had a tummy bug and we were encouraged to let him eat whatever he wanted when he was recovering as he had been so unwell. Obviously, that had to eventually stop. So he would make sick noises if he didn’t want to eat what we had given him.
Then he discovered he had a gag reflex when drinking from a long straw, and that he could trigger it. Lasted a couple of weeks, never actually made himself sick but did it for attention.
He has settled into nursery but does cry upon drop off, and gets very phlegmy. You can see where this is going.
He was ‘sick’ once going into nursery so we went straight home, and has been a couple of times since. But they and I cottoned on quickly. No fuss clean up, extra food offered, no mention of it. I also dress him in his favourite clothes and give plain for nursery spades which he doesn’t want to wear.
Unsurprisingly, he has now stopped. Just another (gross, dramatic) phase!