That ignorance of the law is no excuse, even if it's compounded with stupidity, is the unmistakable moral to be made from "Midnight Express," which is based on the true story of an American jailed in Turkey for drug possession.

But it doesn't seem to have been the point intended by the filmmakers. With not only the obvious viewpoint of the person who had the experience to go on, lurid atrocities have been added to fashion what seems intended to be a tale of outrage at the barbaric treatment of a normal American boy.

William Hayes was arrested in 1970 when he attempted to leave Turkey with some four pounds of hashish concealed about his body. He was given a sentence of four years' imprisonment for drug possession, which, in the course of his appeal, was changed by the higher court to 30 years on the ground that the crime was not merely possession but attempted smuggling.

There is unquestionably a great tragedy there, in the harshness of the punishment, its length compounded by the alien surroundings and the brutality of the jailers. This last is not unique to Turkey, but is shown in the film as being unusual in its viciousness - the beating of the soles of the feet being a favorite feature of this prison.

But the film has its hero, when Brad Davis plays with the World War II movie range of emotions - plucky to crazy-eyed - doggedly believing that his punishment was not brought on by any crime. At no time - apparently not when he plans the smuggling, and certainly not after the punishment for it has been taking up years of his life - does he believe that the drug laws were meant to be taken seriously.

He seems to regard it as an adolescent prank, for which he should, indeed, have to tell his parents that he is sorry, but never a crime. After the original arrest, he is offered freedom in exchange for pointing out his sources, but although he cooperates - no moral conflict in doing so is suggested - he uses the opportunity to attempt running away, still not understanding his legal predicament.

In his appeal, after four years in jail, Hayes i is still saying that "What's legal today is illegal tomorrow, and whats illegal today is legal tomorrow because everybody's doing it," as if he were guilty of nothing more than a slip-up for not keeping posted on the rules. The suggestion that Turkish law has been capricious on the subject of drugs is ridiculous. It leaves Hayes with no explanation of his imprisonment except that Turkey is "a nation of pigs."

With that as the angle, the film is entirely occupied with the excruciating circumstances of life in a Turkish prison, a place depicted as somewhat like an 18th-century English jail in its atmosphere of an improverished but teeming market place.

At the end, the film gives itself credit for progress of prisoner exchanges between Turkey and the United States. But at no time does it suggest that one way to stay out of foreign jails might be to obey local laws.

MIDNIGHT EXPRESS - K-S Cerbenn, K-S Fine Arts, K-S Georgetown Square, K-B Langley, New Carrolian, Oxon Hill, Roth's Tysons Connor and Springfield Mall.