The trial of Alexandria prosecutor William L. Cowhig on an illegal gambling charge began yesterday as lawyers in opening arguments presented contrasting versions of Cowhig's presence at bingo games in the city.

Special prosecutor Edward J. White told the Alexandria Circuit Court jury that Cowhig was instrumental in the organizing and running of allegedly illegal bingo games conducted by B & J Specialties, Inc., in 1977. Cowhig "personally profited" from the bingo games, and attempted to "cover up" his involvement when police began investigating, White said.

Defense attorney Blair Lee Howard countered that Cowhig had done nothing more than attend several games "in fulfilling his obligation as Commonwealth Attorney" in a city where many questions about bingo games had arisen. Cowhig had not organized the games that were run by others, Howard said.

None of the seven witnesses called by White yesterday connected Cowhig directly to the operation of the bingo games. All of them testified they had seen the 53-year-old prosecutor at the games on various occasions, either talking to the managers of the bingo parlor, located at 4603 Duke St., or chatting with customers. Cowhig often purchased ice cream cones at a nearby store before entering the bingo hall, several people said.

An Alexandria policeman, William F. Yost, who worked at the bingo hall as a security guard when off-duty, testified he "assumed" Cowhig was present in an official capacity or because he was interested as a prosecutor in the activities of a massage parlor and X-rated movie theater located in the same shopping mall.

Cowhig has been under fire for nearly a year since allegations surfaced about his connection to lucrative bingo games in the city, which last year grossed a reported total of $1.2 million. Cowhig was indicted last Aug. 3 on three counts relating to bingo, becoming the first commonwealth's attorney in Virginia history to be indicted while in office.

The gambling indictment charges that he helped organize, manage, and personally profit from allegedly illegal bingo games run by B & J from March 1 to Sept. 1, 1977.

Last month Cowhig was acquitted of a charge that he had asked for and received $32,000 in bribes from the operator of bingo games run by the Montessori School of Alexandria, Inc. He is scheduled to stand trial March 5 on another illegal gambling charge in connection with bingo games run on behalf of an Explorer Scout troop Cowhig helped organize.

Cowhig has declined all comment on the indictments except to plead "not guilty" in a strong voice yesterday, as he did at the bribery trial last month.

Under Virginia law, bingo games are permitted only when they are conducted by unpaid volunteer members of a sponsoring charitable organization. Before his indictment Cowhig told The Washington Post that as a lawyer in private practice he had acted as the incorporating attorney for B & J Specialities, Inc., a for-profit firm that he said manufactured desk sets and commemorative plaques.

The owner of B & J Specialties, James R. Fike, has been indicted on illegal gambling charges in connection with bingo. Fike recently was convicted of a misdemeanor violation of the state bingo law in another matter.

The calm, quiet atmospher in the courtroom yesterday contrasted sharply with Cowhig's first trial, when defense attorneys had loudly castigated the motives of witnesses against Cowhig, and f equently interrupted prosecutor White with heated objections.

Cowhig yesterday sat stoically at the defense table in the high-ceilinged courtroom, occasionally whispering with defense attorneys Howard and James C. Clark. During recesses he chatted with old friends.

White was frustrated in his efforts to introduce testimony and exhibits concerning the profitability of other bingo games previously held at the Duke Street location when presiding Judge Percy Thornton Jr. sustained defense objections that such material was not relevant to the Cowhig case.

Robert Gerber, an Alexandria contractor who testified he had been granted immunity from prosecution by White in exchange for his testimony, testified that he had seen Cowhig's wife, Shirley, and Cowhig's daughter, Mary Jo, working at the bingo hall.

Gerber testified that he had loaned Robert Hinkle, the manager of the hall, $1,200 to start the games. Gerber testified that the rent for the bingo parlor was $3,500 each month. Defense attorneys successfully stopped Gerber from explaining to the jury how a $1,000 deficit in rent payments during one month had been made up.