A Bay Shore man on trial for killing a woman in a Bohemia motel and shooting at police three years ago told a forensic psychologist that he couldn’t have committed the crime because his alternate personality did it, the psychologist testified Monday.

But Suffolk prosecutors accused the psychologist of determining that Stoker Olukotun Williams, 27, was mentally ill at the time only after doing a shoddy, incomplete examination designed to come to that conclusion.

Williams is accused of shooting Shalece Cunningham, 24, of Bay Shore in the head at the MacArthur Inn, where she used a room to work as a prostitute. He is charged with first-degree murder, two counts of first-degree attempted murder and other crimes.

“Mr. Williams told me that he is in communication with a character, a person named Malik,” said Marc Janoson, the forensic psychologist hired by the defense. “He told me that Malik is a black Jamaican, and he is responsible for this crime.”

Williams has been representing himself at the trial before state Supreme Court Justice William Condon in Riverhead, but he asked his legal adviser defense attorney Joseph Hanshe of Sayville to question Janoson.

Williams had been able to resist Malik’s demands to beat people and rob banks in the past, but Malik got the better of him on Sept. 7, 2013, the psychologist testified.

advertisement | advertise on newsday

“He reported that Malik told him prostitutes are bad people, that they don’t pay taxes,” Janoson said.

Janoson administered several psychological tests over three visits with Williams. One of them suggested he might have been exaggerating his symptoms, but the other tests suggested he was schizophrenic, Janoson said.

“It is a clearly psychotic profile,” he said.

Assistant District Attorney Robert Biancavilla didn’t buy it, acidly noting that Janoson has never testified for prosecutors in his career.

“You want this jury to believe he’s not responsible for these murders,” Biancavilla said. “You work [always] for the defense.”

Janoson agreed.

Biancavilla attacked Janoson’s work as incomplete. Janoson conceded he didn’t review what Williams told police after his arrest, his school records or medical records, and made little effort to talk to people who knew Williams.

Biancavilla suggested that Williams, who took 54 credits at the University of Phoenix in criminal justice, may have learned there how to feign mental illness.

advertisement | advertise on newsday

At one point, Janoson told Biancavilla, “You’re trying to distort the truth.”

“No, that’s not me,” the prosecutor replied.

“You based your assessment on what he told you, and what you believed to be true,” Biancavilla said. Janoson said Biancavilla’s questions about his practices were inappropriate.

“I don’t really care what you think, doc,” Biancavilla said.

Testimony is expected to conclude Tuesday.