During the time of the second temple (c. 516 BCE to 70 CE) Gentiles were excluded from entering the Temple past the outer court (which was known as the Court of the Gentiles). But there are numerous cases in Scripture of Gentiles attending synagogues around the Roman world. Of course, there could well have been some synagogues that did not allow Gentiles, but Scripture, as far as I can see, doesn’t mention any.
Here are some passages from Acts showing that gentiles did attend the synagogue:
(14) but they went on from Perga and came to Antioch in Pisidia. And on the Sabbath day they went into the synagogue and sat down. (15) After the reading from the Law and the Prophets, the rulers of the synagogue sent a message to them, saying, “Brothers, if you have any word of encouragement for the people, say it.”
(16) So Paul stood up, and motioning with his hand said: “Men of Israel and you who fear God, listen. …
(26) “Brothers, sons of the family of Abraham, and those among you who fear God, to us has been sent the message of this salvation. …
(38) Let it be known to you therefore, brothers, that through this man forgiveness of sins is proclaimed to you, (39) and by him everyone who believes is freed from everything from which you could not be freed by the law of Moses. …
(43) And after the meeting of the synagogue broke up, many Jews and devout converts to Judaism followed Paul and Barnabas, who, as they spoke with them, urged them to continue in the grace of God. (44) The next Sabbath almost the whole city gathered to hear the word of the Lord. (45) But when the Jews saw the crowds, they were filled with jealousy and began to contradict what was spoken by Paul, reviling him. (46) And Paul and Barnabas spoke out boldly, saying, “It was necessary that the word of God be spoken first to you. Since you thrust it aside and judge yourselves unworthy of eternal life, behold, we are turning to the Gentiles. (47) For so the Lord has commanded us, saying, “‘I have made you a light for the Gentiles, that you may bring salvation to the ends of the earth.'”
(48) And when the Gentiles heard this, they began rejoicing and glorifying the word of the Lord, and as many as were appointed to eternal life believed. (49) And the word of the Lord was spreading throughout the whole region. (50) But the Jews incited the devout women of high standing and the leading men of the city, stirred up persecution against Paul and Barnabas, and drove them out of their district.
Now at Iconium they entered together into the Jewish synagogue and spoke in such a way that a great number of both Jews and Greeks believed. (2) But the unbelieving Jews stirred up the Gentiles and poisoned their minds against the brothers.
Now when they had passed through Amphipolis and Apollonia, they came to Thessalonica, where there was a synagogue of the Jews. (2) And Paul went in, as was his custom, and on three Sabbath days he reasoned with them from the Scriptures, (3) explaining and proving that it was necessary for the Christ to suffer and to rise from the dead, and saying, “This Jesus, whom I proclaim to you, is the Christ.” (4) And some of them were persuaded and joined Paul and Silas, as did a great many of the devout Greeks and not a few of the leading women.
And he reasoned in the synagogue every Sabbath, and tried to persuade Jews and Greeks.