The Senate is to be asked today to make a new try at the massive and controversial task of revising and consolidating all federal criminal laws into a single code for the first time in American history.

That's the aim of a bill entitled the Criminal Code Reform Act of 1977, which is expected to be introduced in the Senate today to Sens. Edward M. Kennedy (D-Mass.) and John L. McClellan (D-Ark.).

Their legislative proposal marks the latest turn in an 11-year struggle to sort out the tangled skein of federal criminal laws enacted over the past 200 years and bring them into conformity with the needs of modern society.

Until now, the struggle has been centered on another piece of legislation that was introduced in the Senate in 1975 and has become known in congressional and legal circles by the shorthand name of S. 1.

Since last year, though S. 1 has been mired hopelessly in the Senate Judiciary Committee - the victim of a bitter dispute between liberals and conservatives about whether its purported reforms are actually a blueprint for governmental repression.

The Kennedy-McClellan bill aims at breaking the impasse by replacing S. 1 with a streamlined, new version of code change that eliminates many of the old bill's most controversial features. Although the new proposal has not yet been made public, sources familiar with its contents say it deletes or substantially modifies such liberal opposed S. 1 provisions as:

A so-Called official secrets act, creating new categories of crime in the disclosure and publishing of government secrets and making it easier for federal authorities to prosecute and press for publishing classified information leaked by government sources.

Expansion of the death penalty to cover treason, espionage, sabotage and murder - offenses that were subject to capital punishment before the Supreme Court's 1972 ruling striking down then-existing death penalty laws as unconstitutional.

Abolition of insanity as a defense in federal criminal trials.

A system of sentencing penalties so severe that it drew the fire of the normally conservative American Bar Association.

Creation of a new rule that became known as the "Ehrlichman defense" and that, in the view of its critics, would have granted immunity from prosecution to the top Watergate defendants and to other government officials who break the law on the grounds that they were obeying orders.

According to the sources, the new bill drops the official secrets and Ehrlichman defense provisions completely. It keeps the death penalty limited to cases of aircraft piracy, as spelled out in a post-1972 law: and it retains insanity as a valid defense in accordance with the definitions of criminal insanity used by the various federal judicial circuits.

In the area of sentencing and corrections, the new bill adopts a position that has been winning broad support in legal and law-enforcement circles - the idea that fixed punishment for specific crimes should replace the present system under which judges sentence convicted felons to an indeterminate range of years and leave to parole authorities the decision on when the person should be released.

The bill would create a dederal sentencing commission to recommend appropriate fixed terms for all federal crimes, and judges would be expected to follow these guidelines, except in unusual cases.

The aim is to make punishment fairer and more uniform by eliminating a system that frequently sees poor and minority defendants receive harsher-sentences than more affluent people.

In another provision of great interest to liberals the bill provides for the virtual decriminalization of marijuana possession. It would regard possession of up to 10 grams, or approximately 20 cigarettes, as no crime and would make possession of more than 10 grams a misdemeanor punishable by a 30-day jail term and a $500 fine.

On the other side, the bill tries to appeal to conservatives by significantly expanding the legal tools available to federal law enforcement agencies to fight crime.

In particular, the bill provides a number of new laws for attacking sophisticated white-collar crime and broadens the laws dealing with organized crime to cover the "operating of a racketeering syndicate," investing of rackets money in legitimate businesses and charging usurious rates in loan sharking operations.

This balancing act is predicated on the assumption that the nation has an overriding concern transcending political ideologies in weeding out obsolete and contradictory laws and making that body of law that remains more responsive to modern needs.

That was the aim prompting the chain of events that began in 1966, when President Johnson appointed a commission to study the federal code and that led through innumerable hearings and reports to the S. 1 bill.

Along the way, however, the impetus was lost in a political atmosphere that was the legacy of the Nixon administration - the suspicion of liberals that the code revision of liberal might become a mechanism for reecting a police state.

But, almost everyone seems to agree that the original idea remains a worthwhile goal. It was agreement on that point that led McClellan, the principal conservative backer of S.1. and Kennedy, a major figure among congressional liberals, to collaborate on a new bill aimed at bridging the differences between the two camps and allowing the code revision to become a reality.

Aides to the two senators concede that they still expect considerable opposition from both sides of the political spectrum. But, they add, their compromise bill has been worked out in close negotiations with President Carter's new team at the Justice Department, and the proposal is expected to win strong public backing from Attorney General Griffin B. Bell and the President.

Although congressional circles already have dubbed it "son of S.1." the new bill is a stripped down effort that reduces the 799 pages of S.1 to fewer than 300.