"A Piece of the Action," the third co-starring vehicle Sideny Poitier has directed for himself and Bill Cosby, is a winning light entertainment and a notable improvement upon its predecessors. "Uptown Saturday Night" and "Let's Do It Again."

The key to the improvement appears to be an exceptionally effective screenplay, which achieves a spirited, tangy blend of conventional caper melodrama, conventional romantic comedy and eloquent propagandizing on behalf of measures intended to encourage self-reliance and self-respect in black juveniles.

Credited to Charles Blackwell from a story by Timothy March, the script reflects an attitude that is perhaps the most attractive imaginable for any writer trying to reach a mass audience in a popular entertainment medium: it's warm-hearted yet hard-headed. I don't know if Blackwell was principally responsible for sustaining this gratifying tone, or if is grew out of a collaborative set of convictions, but it's one of the clearest, sweetest tones to ring out from a Hollywood movie in he '70s.

Since Timothy March also received a story credit on "Let's Do It Again," I'll hazard a guess that he was responsible for the con-game premise that starts "Action," now at area theaters, rolling. It's a clever, nifty premise, whoever suggested it. Cosby, a daring safecracker, is discovered pulling off a job that calls for an astonishing stunt finish, a leap from a 12-story window onto a waiting getaway truck that rivals that ski-jump at the opening of "The Spy Who Loved Me" for awesome thrills. Poitier is then introduced as a bunco artist who directs his confederates in a successful scheme to swindle a mobster, played by Titos Vandis.

The plot suffers a brief attack of redundancy by depicting a second Cosby caper, a rather clumsy and brutal robbery scheme that seems out of keeping with the introduction and totally pointless for expository purposes, before moving on to spring the satisfying surprise that smart operators Cosby and Poitier are at the mercy of a smarter operator. James Earl Jones, a retiring police detective, contacts them anonymously with the option of going to jail or spending 40 hours a week in volunteer work at a youth center founded by his late wife.

Poitier and Cosby submit, privately intending to back out of the deal as soon as they can discover exactly what was entrapped them. In the meantime and in the tradition of bad hombres inspired to go straight, they get attacked to good works. Cosby falls for the center's director, Denise Nicholas, and Poitier brings order and purpose to an unruly group of kids enrolled in a job-preparedness class.

Although the delinquency of the personable, sassy young actors and actresses chosen to play these potential rejects and troublemakers is more theoretical than apparent, one can appreciate the general idea as well as the solution advocated by Poitier, who is obliged to reform himself while assuming the role of a middle-class reformer.

Some white liberals may be in for a slight shock, because Poitier takes a deliberately unpermissive line with the kids. He offers tangible, cash incentives for taking the class seriously, but he also makes it clear that he won't be taken. He accusses the kids of "wearing your ignorance like a badge of honor" and vows that the class will be conducted "on a professional basis," with the immediate objective of imparting some basic job-hunting know-how and the ultimate objective of making the kids "responsible for your own existence."

One might criticize the filmmakers for formulating and resolving the youth problem artificially, but they can't be accused of inventing an unreal social problem or advocating equivocol solutions. The approach is clear-cut: Definite things will be demanded of the kids and no excuses for goofing off will be acceptable.

One ran anticipate complaints along the lines of, "That's all very well for a Sidney Poitier, he's got his already," but such complaints won't get you anywhere even if they've got a certain validity. Poitier may be a middle-class model, but that's no mean role model after all. It would require an almost paranoid suspicion of "bourgeois values" to deny either his personal appeal or the sincerity and potency of the example he's trying to set.

Happily, Poitier himself is no longer resisting the role, as he was half-heartedly attempting to do in such misfired "revolutionary" vehicles as "The Lost Man."

For some reason the script seems to neglect an obvious chance at romantic comedy symmetry. Although Cosby and Nicholas are matched, Poititer is given a cutie-pie mistress, Tracy Reed, instead of something potentially richer, a developing romance with Hope Clarke, cast as the well-meaning but prim, flustered instructor whose class the rescues.

Tracy Reed is undeniably gorgeous, but the fact remains that she is a gorgeous appendage in this story. The best thing about her character is that it provides the excuse for introducing another character, her tipsy aunt, played by an effectively disguised but incisively funny Janet DuBois. Hope Carke's character and performance suggest much more grown-up and touching romantic possibilities. The actress and the writer seem to have accomplished the difficult feat of portraying an up-tight woman affectionately, and I think it would be more satisfying if Poitier's character were in a position to reap the benefits when Clark's begins to loosen up.

I also wish Poitier were a little slicker behind the camera. "A Piece of the Action" seems his most controlled and least cluttered picture to date but a nimbler, more attentive and sensitive eye seem to be called for now and again. For example, Cosby does not funniest physical comedy on the dance floor, but the sequences are not framed as securely and wittily as they could be. The camera can't get Cosby exactly centered, although he's the central attraction at such moments.

The neatest performance in the film is Jones' stern, laconic policeman. Jones may have evolved into the most reliable and versatile actor now working in American films. An island of competence in supporting roles in such godforsaken enterprises as "Exorcist II" and "The Last Remake of Beau Geste," he makes his supporting rule in "Action" feel like a lead, underplayed but inherently strong and sexually magnetic.

One can never be certain when the chemistry on any given film project will work. "Uptown Saturday Night" and "Let's Do It Again" seemed laborious efforts at ingratiating movie-making. Poitier had done it right this time: "A Piece of the Action" is proficiently and cleverly ingratiating.