The St Ives Area Neighbourhood Development Plan, which was backed by 83 per cent of voters on a turnout of 42 per cent in a referendum on 5 May, includes a policy that would require new homes to be occupied as the buyer's main residence.
Developers RLT Built Environment Ltd said the policy would leave second home owners liable to prosecution and violate their human rights.
But Mr Justice Hickinbottom said today he "unimpressed" by arguments that second and holiday homes caused no real harm to the seaside town.
New homes can from now on only be built and sold in St Ives on condition that they will be occupied as "principal residences".
Any householder moving into the area who defies the ban could face enforcement action by planners and, ultimately, prosecution.
RLT Built Environment said the ban would catastrophically depress the market for new home building in the town.
The restriction on householders' liberty to do what they wanted with their homes was disproportionate and unjustified, the company claimed.
And the new policy amounted to a breach of their right under Article 8 of the European Convention on Human Rights.
Dismissing the challenge, however, the judge said the plan had been exhaustively examined before being put to referendum.
The ban on using any new houses built in the town as second homes would be reflected in the prices paid for them, he added.
New residents would be well aware of the restriction and the potential consequences of disobedience.
And, before any enforcement action could be taken against them, they would be entitled to have their say.
The judge ruled that Cornwall Council, which opened the way for the referendum, was entitled to conclude that the ban would contribute to sustainable development in St Ives.
And there was nothing irrational about the conclusion that "uncontrolled growth" of second and holiday homes was damaging the town.
R on the Application of RLT Built Environment Limited v The Cornwall Council. Case Number: CO/2241/2016