Mark Coulburn, 30, of HMP Garth, Walton Lane, Leyland, is then said to have hurled the weapon out of a window.
He denies wounding fellow inmate Billy Moriarty with intent to cause grievous bodily harm on July 28 last year, and unauthorised possession of a weapon in prison.
However, Preston Crown Court was told both Mr Moriarty and Coulburn would not give an account to police, and Mr Coulburn has not attended the trial.
Bob Golinski, prosecuting, told the jury the victim suffered a number of puncture wounds to his body on July 27, at around 4.15pm, as the pair queued at a ‘treatment hatch’ for medication.
Footage of the incident was caught on the prison’s CCTV system.
He told jurors prison officer Christopher Alexander was in a staff room when he heard a commotion and a voice shouting: “Stop it.”
As he approached the area he saw Coulburn pushing Mr Moriarty, before “striking out” a number of times, with Coulburn making a jabbing motion rather than a punching motion. The victim suffered numerous stab wounds.
Mr Alexander following Coulburn and saw him near an open window. A homemade weapon was later found on flooring near the window, with DNA matching Coulburn’s.