Earlier this month, Paris prosecutors stepped up a preliminary probe into X for suspected algorithmic bias and fraudulent data extraction, enlisting police to investigate alleged wrongdoing by the company or its executives.
"Based on what we know so far, X believes that this investigation is distorting French law in order to serve a political agenda and, ultimately, restrict free speech," the social network posted on its Global Government Affairs account.
"For these reasons, X has not acceded to the French authorities' demands, as we have a legal right to do."
In the blistering attack, X also said the probe had been instigated by Eric Bothorel, a French MP, who had accused "X of manipulating its algorithm for 'foreign interference' purposes, an allegation which is completely false".
The Paris prosecutors' office did not immediately respond to a request for comment. Neither did Bothorel.
Musk, a former ally of US President Donald Trump, has accused European governments of attacking free speech and has voiced support for some of the region's far-right parties.
The French probe could deepen a rift between Washington and European capitals over what sort of discourse is permitted online, with senior officials from Trump's administration alleging the censoring of right-wing voices around the world.
X said Paris prosecutors had requested it hand over "recommendation algorithm and real-time data about all user posts on the platform", for analysis by researchers David Chavalarias and Maziyar Panahi, who it said had both exhibited "open hostility towards X", calling into question the impartiality of the investigation.
Neither Chavalarias nor Panahi immediately responded to a request for comment.
X also chafed at the fact that it was being investigated under organised crime charges, which it said would grant the police measures including wiretapping its employees' personal devices.
Pavel Durov, the Russian-born founder of the Telegram messaging app, is also under judicial supervision in France after being arrested last year and placed under formal investigation for alleged organised crime on the app. He denies guilt.
Early in July, Musk responded "true" to a post on X in which Durov said the French "bureaucrats" investigating X were "waging a crusade against free speech and tech progress".