The suspect committed the offences on April 17 at 5.00 p.m. on Joseph Dosu Way, Badagry.
Mr Adeosun said Mr Afeez sexually penetrated the vagina of the 12-year-old girl with his fingers.
The prosecutor said the offence contravened sections 287, 411, and 308 of the Criminal Law of Lagos State.
The defendants, however, pleaded not guilty to all the charges.
Mr Obiwa is standing trial on a charge of stealing, to which he pleaded not guilty.
Aro Akeem, 20, and Babatunde George, 27, are being charged for defilement, indecent assault and abduction.
The defendant was said to have dragged the girl into a nearby bush and attempted to rape her.
