* Brazil's Ibama agency says it will fine Petrobras
* Petrobras says cleaned 317 gallons of oil from beach
* Steelmaker CSN reports oil spill into Brazil river
* CSN says spill of 13,000 gallons is "contained" (New throughout, adds details and background)
RIO DE JANEIRO, Jan 27 (Reuters) - Brazil's environmental protection agency plans to fine oil giant Petrobras for a southern Brazilian oil spill this week that fouled a beach, the agency said on Friday.
Petrobras said it has cleaned up the 317 gallons (1.2 cubic meters) of oil that washed ashore from a leaking buoy onto Tramandai beach in Rio Grande do Sul on Thursday, in Brazil's far south.
Transpetro, the shipping unit of Brazil's state-run oil firm and the buoy's operator, is investigating what caused the spill.
The oil leaked about 6 kilometers (4 miles) offshore, but was swept ashore by ocean currents, Ibama's regional superintendent Joao Moreira Junior told Reuters.
After Ibama assesses environmental damages, it will apply a fine that could range from $50,000 reais ($28,000) to a maximum of 50 million reais ($28 million), Moreira Junior said.
Transpetro's buoy connects oil tankers to a pipeline at its coastal Osorio terminal, which supplies a Petrobras refinery in Canoas, Brazil.
Spill containment crews remain on site, although Petrobras said the leak is contained and there is no sign of more oil in the water.
CSN OIL SPILL
Separately, Brazilian steelmaker CSN said it spilled oil on Thursday into the Paraiba do Sul River in Rio de Janeiro State, near its Presidente Vargas steel mill.
A company spokesman estimated the spill at around 50 cubic meters (13,209 gallons) of oil, but said the quantity isn't certain yet.
CSN says the spill was contained by a barrier in a river tributary, thus posing little or no risk to water supplies. The river serves as a key source of drinking water for Rio de Janeiro state.
Rio's state-run water utility, CEDAE, said "the leak was contained in a tributary before it reached an area where we collect drinking water."
CSN, Brazil's largest diversified steelmaking group, has a history of spills in the Paraiba River. Efforts to reach the media office for the Rio de Janeiro-based watchdog were unsuccessful.
A 2009 oil spill there by CSN led to a 5 million real ($2.8 million) fine, O Globo newspaper reported on Friday. CSN also spilled charcoal waste into the river in 2010, resulting in a 20 million real ($11.2 million) fine, the paper said.
CSN was also fined in 2009 after dust from its coal coke plant covered most of the city of Volta Redonda, where its main mill is located, for several days. Rio de Janeiro state authorities cited CSN for violations to environmental rules at the time. (Reporting By Joshua Schneyer and Guillermo Parra-Bernal; Editing by Jeb Blount, Phil Berlowitz and David Gregorio)