Sen. James B. Allen (D-Ala.), a master of filibuster who was one of the Senate's most inventive and ingenious parliamentary tacticians, died yesterday in Alabama. He was 65.

Death was attributed to an apparent heart attack. Witnesses said he was at a condominium at Gulf Shores, Ala., when he appeared to suffer the attack and fell down stairs.

He was pronounced dead late yesterday in a hospital in Foley, Ala.

Elected to the Senate in 1968, Sen. Allen gloried and thrived in the give-and-take of floor debate, where he wielded his prodigiuos knowledge of Senate rules in the service of conservative causes.

Most recently, he attracted wide-spread notice as one of the Senate's principal and most outspoken opponents of the Panama Canal treaties.

The treaties were ratified, but not before Sen. Allen had made a determined effort to kill them through tactics that emphasized attempts to add a series of complicating amendments.

His role in the canal debate was consistent with the role in which he has become known over the years - as a man whose prime interest was in floor debate rather than in the off-the-floor committee work or behind-the-scenes maneuvering in which many other senators make their reputations.

Sen. Allen was born in Gadsden, Ala. and attended puclic schools there, the University of Alabama and the university of Alabama Law School. He began practicing law in Gadsden in 1935.

During World War II, he served in the Navy in the Pacific, participating in the Leyte and Oklahoma campaigns.

From 1951-55, and from 1963-67, he served as lieutenant governor of Alabama.

From 1938-42, he served in the Alabama House and from 1946-50 in the Alabama Senate. There, according to some observers, he began acquiring the mastery of legislative rules that he showed to such effect in the U.S. Senate.

The sight of his shambling, bear-like figure rising to speak in the upper chamber was enough to make liberals tremble with concern for the fate of their legislation.

In addition to the Panama Canal treaties, he opposed many measures calling for increased federal spending, public financing of elections and expanding civil rights.

Although he could not always stop measures he opposed, he could and did delay their passage.

Among the weapons in his arsenal were frequent use of the quorum call, the demand for a "live quorum" and the refusal to allow the canceling of a quorum call.

Observers of the Senate credited him with devising new means of extending debate after cloture had been invoked and a 100-hour limit set.

Among these tactics was call for debate on the question of whether the Senate sergeant at arms should be sent to round up senators absent for a quorum call. Such debate, it developed, did not exhaust any of the 100 hours alloted.

Despite the tenacity with which he fought on the floor, Sen. Allen was known as a calm, quiet and polite man who never shouted and could display a dry and pleasant sense of humor.

He was married and had three children and three step-children.

Funeral arrangements were immediately known last night. There was no immediate word on who would fill the last two years of his term.