I would also try to sub vegetable broth for the dairy, maybe adding a touch of soy milk. But you must taste your soy milk first to ensure it is not sweetened at all--even some of the "original" flavors are sweetened. If you are using only broth and need to thicken the liquid a bit, make a slurry with a small amount of the broth and cornstarch.

There are a few vegan cheese substitutes that aren't too bad and could work for a gratin, Daiya makes a few varieties that work fairly well. You could also mix fine bread crumbs with nutritional yeast or make a sauce from soaked ground cashews (or other nuts) mixed with garlic and herbs, tossing this mix with a bit of crumb would help with the crisp texture.

I second maryvelasquez on bechamel sauce. I make mine with olive oil, garlic, rice flour, vegetable broth and coconut milk...but you can vary the ingredients to your taste. A dash of nutritional yeast makes it extra cheesy.

You will even get some browning in the oven the way you do with cheese. vvvaness's suggestion of breadcrumbs would be a great way to finish it.

Many gratins in France are made without cheese at all. So a vegan gratin becomes considerably easier to achieve if you don't worry about a sub for cheese. I agree that I'd probably go with a vegan broth sub for the dairy (mushroom is especially tasty).