Segregating boys and girls in a mixed-sex Muslim state school amounts to "a kind of apartheid", the Court of Appeal heard on Tuesday.
In the first case of its kind, Ofsted is challenging a High Court ruling clearing Al-Hijrah school in Birmingham of unlawful sex discrimination.
The school is resisting the appeal and has sought to block Ofsted's report.
But lawyers for the watchdog say segregation leaves girls "unprepared for life in modern Britain".
In a report last summer, Ofsted ruled that the mixed-sex school was inadequate, saying that its policy of separating the sexes from the age of 10 was discrimination under the 2010 Equality Act.
But in November, High Court judge Mr Justice Jay overruled the inspectors, saying that they had taken an "erroneous" view on an issue "of considerable public importance".
He allowed Ofsted to publish the rest of its inspection report which placed the school into special measures, after inspectors found books in the school library giving tacit approval to domestic violence.
Amanda Spielman, England's Chief Inspector of Schools, who is in court in person, is appealing over the segregation ruling.
Representing Ofsted, Helen Mounfield QC, asked the three appeal judges to rule that Mr Justice Jay "erred in concluding the gender segregation observed in this school is not discriminatory".
She argued that the judge had taken the wrong approach by only considering whether girls at the school were treated less favourably than the boys "as a group".
Instead, he should have asked "whether individual pupils suffered particular detriment which pupils of the opposite sex would not suffer", she said.
"If boys and girls in a school which is registered as a mixed-sex school lose the opportunity to work and socialise confidently with members of the opposite sex, as Ofsted says they should do, they will go into the world unprepared for life in modern Britain where they are expected to be able to work and socialise in mixed-sex environments," she argued.
She said that this type of segregation puts girls at a particular disadvantage because they are "part of a group with the minority of power in society".
It also puts girls and women at a psychological disadvantage in the workplace where "there are more powerful men than women", said Ms Mountfield.
The voluntary aided school, which was maintained by Birmingham City Council at the time of the inspection, admits boys and girls aged four to 16 but completely separates them from Year 5 for lessons, breaks, school trips and school clubs, the court heard.
The original Ofsted report was amended in August last year to reflect the fact that previous inspections had not commented adversely on the segregation.
Lawyers for the school's interim executive board said in a statement they were resisting the appeal, adding: "The board says, as the High Court judge found, that boys and girls are treated entirely equally at the school and there is no bar on separating boys and girls as it has done.
"It points out that Ofsted did not claim that separation was discrimination until 2016."
Martin Chamberlain QC, appearing for the education secretary, said the minister supported Ofsted's application for judicial review.
And Dan Squires QC for the Equality and Human Rights Commission said it was very difficult to ensure in a complex area like education that, where there was segregation, facilities were "separate but equal".
Sir Terence Etherton, Master of the Rolls, who is sitting with Lady Justice Gloster and Lord Justice Beatson, said that if the appeal succeeded "a number of schools" could find themselves operating an unlawful system.
The Department for Education said that the Appeal Court ruling would apply to all schools, not just state schools, as the case is based on the Equalities Act.
A spokesman said: "Mixed schools should only separate children by gender where there is a good reason to do so and they can demonstrate that pupils are not disadvantaged by virtue of gender. We are working with Ofsted on this case to ensure there is clarity on the law on gender segregation in schools."
The case continues on Wednesday.