You can. Make sure you scrub with clean brush that has never been used with soaps.
Rinse the rock with saltwater the same as the aquarium.
This will insure that the natural bacteria and good stuff lives on the rock.
Then you also need to address the reasons for the algae.
Lower phosphate and nitrates, feed less and ensure something is actually eating what you add.
If you don’t have any macro algae or corals you could cut the light back. On for a few hours a day or black out for a couple days.
You Could also do a couple big water changes , this would help drop the nutrients down for the algae.