By Jessica Toonkel and Dan Levine

(Reuters) - A Massachusetts judge on Thursday rejected Sumner Redstone's bid to quickly end a case that will likely determine the future of the media mogul's holdings and set an October trial date, marking a victory for Viacom Inc <VIAB.O> Chief Executive Philippe Dauman.

The issue is whether the 93-year-old Redstone knew what he was doing when he removed Dauman and Viacom board member George Abrams in May from the seven-person trust that will control his majority ownership of Viacom and CBS Corp <CBS.N> when he dies or is incapacitated.

Dauman and Abrams filed a lawsuit in Massachusetts, where the trust was established, contesting their removal from the trust and from the board of National Amusements Inc, Redstone's privately-held movie theater company, through which he owns 80 percent of the voting shares of CBS Corp <CBS.N> and Viacom.    

Judge George Phelan of Norfolk County Probate and Family Court in Canton, Massachusetts, rejected Redstone's motion to dismiss and ruled that the case should proceed in Massachusetts. Redstone's lawyers had asked that the case be moved to a California court.

The judge's decision to keep the case in Massachusetts could help Dauman's case, or give him more leverage to negotiate a settlement.

California law mandates that any evidence of mental incompetence be tied to the specific issue being contested. Massachusetts does not have such a strict requirement, and allows a judge to evaluate a person’s overall ability to manage their affairs, lawyers have told Reuters..

While Phelan allowed Dauman's lawyers to examine medical records relating to Redstone, the judge rejected Dauman's request for an immediate mental examination of Redstone. The judge requested that Redstone's medical records from January 1, 2015 to July 28, 2016 be provided by August 15.

In a statement, a spokesman for Abrams and Dauman applauded Phelan's decision because it acknowledged "the need for a speedy trial," and "prompt access to medical records."

Mike Lawrence, a spokesman for Redstone, said he looks forward to "exposing this specious and malicious attack" in court. The decision to remove Dauman and Abrams will stand regardless of the outcome, Lawrence said, because a majority of trustees ratified it.

The outcome of the Massachusetts court case, and who ends up with control over the trust, will have wide-ranging implications for Viacom and CBS shareholders and could result in changes at the top of both companies, possibly through mergers and acquisitions.

Abrams and Dauman claim Redstone suffers from dementia, impaired cognition, a slowness of mental processing, a loss of memory, apathy, depression and has been manipulated by his daughter, Shari.

In a June court filing, Redstone called it "offensive and untrue" to suggest that he was being unduly influenced.

A spokeswoman for Shari Redstone declined to comment.

The outcome of the Massachusetts case also has implications for Viacom's board. Redstone and National Amusements moved to oust five of Viacom's directors last month, including Dauman and lead independent director Frederic Salerno, asking a court in Delaware - where Viacom is incorporated - to rule that the changes were valid.

That same day, Salerno fired back with his own lawsuit challenging the removal.

A hearing on the matter is scheduled for Friday in Delaware.

(Reporting by Jessica Toonkel and Dan Levine; editing by Alan Crosby, Dan Grebler and Nick Zieminski)