Morgan Geyser and Anissa Weier
Morgan Geyser and Anissa Weier were charged with attempted murder over the attack in May 2014 Police handout

A girl accused of stabbing a 12-year-old classmate to please the online bogeyman Slender Man has pleaded not guilty in a US court on grounds of mental illness.

Morgan Geyser and her co-defendant Anissa Weier, both now aged 14, are accused of attempted murder after allegedly stabbing their victim 19 times in May, 2014.

A judge has appointed two doctors to examine Geyser, AP reported.

The victim, Payton Leutner, survived after crawling from woods, and was found by a cyclist near the city of Waukesha, Wisconsin. She had stab wounds to her arms, legs and torso.

The defendants are being tried as adults, and face decades in jail if convicted. Investigators say the pair, who plotted the attack for months, had dedicated it to fictional character Slender Man.

The tall, shadowy figure has featured in countless online stories, photographs and pictures after first appearing in 2009 in the website creepypasta, in a photography competition.

A state appeals court ruled last month that the case should be heard in an adult court, saying it was planned and violent.

The defendants initially planned to kill their unidentified victim at a sleepover in May 2014, according to prosecutors. Instead, they allegedly attacked her in woods the following day.

Fictional web ghoulie Slender Man reportedly inspired schoolgirl\'s murder
Fictional web ghoulie Slender Man reportedly inspired schoolgirl's murder

The two girls, who were 12 at the time, were captured by police later that day walking near a highway with a knife in one of their backpacks.

They told investigators they believed the crime would win them the favour of Slender Man, and said they planned to walk 300 miles to the Nicolet National Forest and live as servants to Slender Man in his mansion.

Leutner recovered from her wounds and returned to school in August.

The next hearing in the case is in October.