Have you been to the doc for this flare. Stopping the flare quickly will help you lose less weight.
When I was around your age I lost a lot of weight due to constant D and nausea which was diagnosed as "spastic colon", but I feel it was UC. I felt bad and did not eat very much and was quite underweight.
It sounds simplistic, but to gain weight you have to increase your caloric intake. Gaining weight is can be just as hard as losing weight. You have to be like someone on a diet and pay attention to what you eating and how often you are eating and you have to use will power. You can't do it all at once or you risk failing. Add calories gradually, but steadily. Learn what food packs the most nutritous calories per oz so you aren't daunted by big meals. Set goals like eating an egg for breakfast and then in a couple days add a mid morning snack of toast and so on.
I read somewhere, that "you have to eat to feel hungry". I think this is very true. When you lose a lot of weight from not eating your appetite disappears and your body no longer lets you know when you need to eat. Even now, many years later I get such a wonderful feeling when my stomach growls from hunger because I remember how awful it was during those years it never did.