The son of tennis legend John McEnroe was arraigned Wednesday night in criminal court on two counts of criminal possession of a controlled substance and released on his own recognizance after being arrested in an alleged drug deal.

Kevin McEnroe was carrying six glassine bags of cocaine and dozens of prescription painkillers, police said yesterday.

The 27-year-old was spotted in what police officers believe was a drug deal at East 4th Street and Avenue A at about 11:15 p.m. Tuesday night. His next court date is Oct. 16, according to the Manhattan District Attorney.

McEnroe’s attorney, Isabelle A. Kirshner, said she had no comment.

McEnroe is the son of John McEnroe and actress Tatum O’Neal, who was arrested cocaine possession in 2008.