Washington defense lawyer Kenneth M. Robinson testified today against a former client, Linwood (Big Boy) Gray, who Robinson said threatened to kill him in a dispute over control of a house Gray deeded to Robinson in partial payment of a $75,000 legal fee.

The testimony came in the second day of trial in federal court here against Gray, whom Robinson defended when Gray was acquitted of leading a $30 million heroin ring, and Harry L. Staley, a Washington insurance broker. Both are charged in the current trial with conspiracy in the alleged death threats against Robinson and an attempt to avoid seizure of the house by government tax agents by concealing Gray's interest in it. Although Gray was acquitted on the 1979 drug charge, he was convicted of income tax evasion.

Robinson, 41, a popular criminal defense lawyer with a dramatic courtroom flair, said he wore a bulletproof vest and kept his office under guard after Gray allegedly threatened him in a phone call from prison in January 1980. Robinson said he construed Gray's remarks in the call as threats against himself, his wife and their two teen-aged daughters. Robinson said he learned that Gray had arranged for a "hired killer" to gun him down.

As partial payment for the 1979 heroin-tax trial defense, Robinson said, Gray deeded his fully paid $60,000 house in Prince George's County to Robinson.

While Gray, 39, was in prison, his common-law wife, Darlene Fleming, and their child were to continue living in the house, paying $500 a month rent, Robinson said. Fleming soon stopped making payments, Robinson said, and when he complained to Gray by phone and said he might consider evicting Fleming and the child, Gray became angry. " 'You say you'd put my babies out?' " Robinson quoted Gray as saying. " ' . . . You got a wife and babies . . . . You want your family hurt?' "

Under questioning by prosecutor David B. Irwin, Robinson said, "From what I knew of Linwood Gray, it was a death threat." Out of fear, Robinson said, he allowed Fleming to live at the house without paying rent, and he eventually transferred the house to Staley.

Robinson's comments came during five hours of grueling and often angry testimony as attorneys for Gray sought to discredit Robinson, questioning him sharply about discrepancies in his tax returns and an immunity agreement he signed with federal prosecutors -- shielding him from prosecution for tax evasion during the years he possessed Gray's house, in exchange for testifying against Gray.

Defense attorneys Fred W. Bennett and Kathleen M. Gallogly contended that Robinson instructed Gray to allow Robinson to hold the house for Gray to avoid government confiscation following Gray's tax evasion conviction in 1979. Robinson denied the accusation.

Robinson acknowledged that there appeared to be several discrepancies in his tax returns, but he said his accountant prepared them and that he knew few of the details. His law firm's corporate returns for 1981, for example, show a $94,840 deduction as compensation to Robinson as chief officer of the firm. But Robinson's personal return for the year shows "zero" in wages and salary, although he shows $249,000 in other forms of income.

"I didn't cheat the IRS," Robinson said. At another point, he added, "If there's mistakes, here, count it up and I'll pay it . . . . But there's no crime here."