No, a person sitting inside the compartment can't tell just by looking at the plumb line whether the train is accelerating on a horizontal straight track or moving on an incline.When the train is accelerating along the horizontal, the tension in the string is mg2+a2​ when it is moving on the inclined plane, the tension is mg. So, by measuring the tension in the string we can differentiate between the two cases.