on the flange side. It doesn't matter which side (in or out) you put the flange, just make sure the O-ring is on that side and not the nut side. That beign said, I prefer to put my flange in tank as I don't like the long end sticking out.
Agreed with above posts. My philosify when plumbing a sink or bath is its better to stop the water as soon as possible. ON THE INSIDE. Usually when the water reaches the outer seal its too late. That said, I recommend putting the flange and seal on the inside of the tank.