Ranieri guided Roma to sixth in Serie A last season after three months in charge and his first game as Samp boss comes against the Giallorossi on 21 October (AEDT).
The 67-year-old takes charge of a team rooted to the foot of the table after seven matches, with the Blucerchiati having won one and lost six.
That run of form this week resulted in the dismissal of Eusebio Di Francesco, whom Ranieri also replaced at Roma.
A statement on Samp's official website read: "President Massimo Ferrero and Sampdoria welcome Claudio Ranieri, who has joined the club as head coach responsible for the first team until 30 June, 2021.
"The president wishes the coach, his staff and the team a good job based on commitment and passion."
Ranieri famously took Leicester City all the way to the Premier League title in England during the 2015-2016 season, barely 12 months after it had narrowly avoided relegation to the Championship.