The last political testament of the late CIA director, William J. Casey, was a blunt, private letter around Nov. 26 to President Reagan urging him to replace Secretary of State George Shultz with former U.N. ambassador Jeane Kirkpatrick to ensure loyalty to the president and his policies.

The letter was an unprecedented attack by one Cabinet member against another. Casey, the daring strategist fighting to carry out what he knew his boss wanted, attacked Shultz, the cautious nay-sayer. Casey was livid that Shultz remained silent instead of backing the president or resigning when Reagan overruled the secretary's opposition to a secret arms channel to Iran -- the most disastrous decision of the Reagan era.

Casey was compulsively and secretly driven by the president ''to get the hostages home and keep the contras going,'' according to one source. No member of the Cabinet felt as bound as Casey to follow Reagan's policies and none was so enraged by what he regarded as Shultz's self-serving survival course.

Ronald Reagan was an admirer of both Casey and Shultz. Instead of choosing between them, he pigeonholed the letter in a characteristic manifestation of indecision.

Casey's letter to the president was mistakenly included in the huge bundle of White House documents sent to the Senate-House Iran-contra investigating committees after the crisis broke. It may never become a part of the public record, although one committee member told us it is ''bound to come out'' officially sooner or later.

It displayed the qualities that made Casey Reagan's special and often lonely champion, and at the same time the hair shirt of the Shultz State Department. As Reagan's champion, Casey is called by Henry Kissinger ''the one patriot with a strategic sense of what Reagan wanted done.'' But the zeal he splurged on Reagan's behalf, including lies and half-truths to protect the president and his policies, helped bring the policy down in shame.

Casey's last letter to Ronald Reagan was triggered by outrage that Shultz, after declining to resign when he lost the Oval Office debate, refused to share the blame with other top administration officials when the Iran arms scandal broke. No course other than taking the blame or resigning was considered ''loyal'' by Casey (and others close to the president). But Shultz found one. He claimed to have been kept in the dark.

Two events in that worsening mid-November nightmare drove Casey toward his attack on Shultz. The first was Shultz's White House battle to prevent Casey from testifying untruthfully to the House Intelligence Committee on Nov. 21. Casey, viewing that battle as essential to protect the president, was livid.

The second event that broke Casey's boiling point was a veiled verbal duel between himself and Undersecretary of State Michael Armacost at that same Nov. 21 closed-door House Intelligence Committee hearing. Attempting to exonerate his boss of any blame for the Iran-arms fiasco, Armacost angered Casey by testifying that Shultz had ''participated in the discussions'' that led to the president's approval of the policy but then had ''no role'' when the actual policy was drafted.

Armacost praised Shultz as ''the principal architect of the counterterrorism policy,'' who was trying to ''frustrate'' all arms sales to terrorist Iran. Casey interrupted at that point, according to the declassified transcript released June 22. ''I would say that the CIA has probably the most effective counterterrorism capability in this government . . . so it {Armacost's logic} doesn't quite follow that clearly.''

Casey went on with some heat. He told the committee that when Reagan decided on the arms sales, ''I thought we were all supporting the president's position -- and I know that we {the CIA} were supporting it.''

Casey's anti-Shultz mood, so manifest that day on the Hill, hardened when he returned to his office and brooded about the president's inability to command his secretary of state's cooperation. He is known to have had similar concerns about the degree of Shultz's support for some other highly controversial Reagan policies, including Nicaragua and southern Africa.

If Reagan could not command complete loyalty from Shultz, Casey wrote the president, he surely could from Jeane Kirkpatrick, whose ideas were embodied in Reagan's foreign policy. But his letter to a president who abhors the task of judging between feuding aides was forgotten inside the White House, along with Bill Casey's sometimes overzealous strategic dreams.